Re: [RFC mm][PATCH 2/5] percpu cached mm counter

From: Minchan Kim
Date: Thu Dec 10 2009 - 20:25:19 EST


On Fri, Dec 11, 2009 at 9:51 AM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> On Fri, 11 Dec 2009 09:40:07 +0900
> Minchan Kim <minchan.kim@xxxxxxxxx> wrote:
>> >Âstatic inline unsigned long get_mm_counter(struct mm_struct *mm, int member)
>> > Â{
>> > - Â Â Â return (unsigned long)atomic_long_read(&(mm)->counters[member]);
>> > + Â Â Â long ret;
>> > + Â Â Â /*
>> > + Â Â Â Â* Because this counter is loosely synchronized with percpu cached
>> > + Â Â Â Â* information, it's possible that value gets to be minus. For user's
>> > + Â Â Â Â* convenience/sanity, avoid returning minus.
>> > + Â Â Â Â*/
>> > + Â Â Â ret = atomic_long_read(&(mm)->counters[member]);
>> > + Â Â Â if (unlikely(ret < 0))
>> > + Â Â Â Â Â Â Â return 0;
>> > + Â Â Â return (unsigned long)ret;
>> > Â}
>>
>> Now, your sync point is only task switching time.
>> So we can't show exact number if many counting of mm happens
>> in short time.(ie, before context switching).
>> It isn't matter?
>>
> I think it's not a matter from 2 reasons.
>
> 1. Now, considering servers which requires continuous memory usage monitoring
> as ps/top, when there are 2000 processes, "ps -elf" takes 0.8sec.
> Because system admins know that gathering process information consumes
> some amount of cpu resource, they will not do that so frequently.(I hope)
>
> 2. When chains of page faults occur continously in a period, the monitor
> of memory usage just see a snapshot of current numbers and "snapshot of what
> moment" is at random, always. No one can get precise number in that kind of situation.
>

Yes. I understand that.

But we did rss updating as batch until now.
It was also stale. Just only your patch make stale period longer.
Hmm. I hope people don't expect mm count is precise.

I saw the many people believed sanpshot of mm counting is real in
embedded system.
They want to know the exact memory usage in system.
Maybe embedded system doesn't use SPLIT_LOCK so that there is no regression.

At least, I would like to add comment "It's not precise value." on
statm's Documentation.
Of course, It's off topic. :)

Thanks for commenting. Kame.
--
Kind regards,
Minchan Kim
--
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/