Re: [PATCH for -mm] getrusage: fill ru_maxrss value

From: Ingo Molnar
Date: Thu Apr 02 2009 - 17:15:23 EST



* Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> I have a note here that this patch needs acks, but I didn't note who
> from.
>
> Someone ack it :)

looks good to me at a quick glance. A stupid technicality. There's
repetitive patterns of:

> + if (current->mm) {
> + unsigned long hiwater_rss = get_mm_hiwater_rss(current->mm);
> +
> + if (sig->maxrss < hiwater_rss)
> + sig->maxrss = hiwater_rss;
> + }

in about 3 separate places. Wouldnt a helper along the lines of:

sig->maxrss = mm_hiwater_rss(current->mm, sig->maxrss);

be much more readable?

The helper could be something like:

static inline unsigned long
mm_hiwater_rss(struct mm_struct *mm, unsigned long maxrss)
{
return max(maxrss, mm ? get_mm_hiwater_rss(mm) : 0);
}

much nicer?

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/