linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Wei Yang <richard.weiyang@gmail.com>,
	akpm@linux-foundation.org, jweiner@fb.com, linux-mm@kvack.org
Subject: Re: [PATCH] mm, show_mem: drop pgdat_resize_lock in show_mem()
Date: Thu, 29 Nov 2018 09:32:49 +0000	[thread overview]
Message-ID: <20181129093249.ztcbo5foncee74zg@master> (raw)
In-Reply-To: <20181129081703.GN6923@dhcp22.suse.cz>

On Thu, Nov 29, 2018 at 09:17:03AM +0100, Michal Hocko wrote:
>On Thu 29-11-18 05:08:15, Wei Yang wrote:
>> Function show_mem() is used to print system memory status when user
>> requires or fail to allocate memory. Generally, this is a best effort
>> information and not willing to affect core mm subsystem.
>
>I would drop the part after and
>
>> The data protected by pgdat_resize_lock is mostly correct except there is:
>> 
>>    * page struct defer init
>>    * memory hotplug
>
>This is more confusing than helpful. I would just drop it.
>
>The changelog doesn't explain what is done and why. The second one is
>much more important. I would say this
>
>"
>Function show_mem() is used to print system memory status when user
>requires or fail to allocate memory. Generally, this is a best effort
>information so any races with memory hotplug (or very theoretically an
>early initialization) should be toleratable and the worst that could
>happen is to print an imprecise node state.
>
>Drop the resize lock because this is the only place which might hold the
>lock from the interrupt context and so all other callers might use a
>simple spinlock. Even though this doesn't solve any real issue it makes
>the code easier to follow and tiny more effective.
>"

Ah, I have to admit this is much clearer and easier for audience to
understand the reason.

Thanks a lot.

>
>> 
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> ---
>>  lib/show_mem.c | 2 --
>>  1 file changed, 2 deletions(-)
>> 
>> diff --git a/lib/show_mem.c b/lib/show_mem.c
>> index 0beaa1d899aa..1d996e5771ab 100644
>> --- a/lib/show_mem.c
>> +++ b/lib/show_mem.c
>> @@ -21,7 +21,6 @@ void show_mem(unsigned int filter, nodemask_t *nodemask)
>>  		unsigned long flags;
>
>btw. you want to drop flags.

Oops, what a shame . :-(

>>  		int zoneid;
>>  
>> -		pgdat_resize_lock(pgdat, &flags);
>>  		for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
>>  			struct zone *zone = &pgdat->node_zones[zoneid];
>>  			if (!populated_zone(zone))
>> @@ -33,7 +32,6 @@ void show_mem(unsigned int filter, nodemask_t *nodemask)
>>  			if (is_highmem_idx(zoneid))
>>  				highmem += zone->present_pages;
>>  		}
>> -		pgdat_resize_unlock(pgdat, &flags);
>>  	}
>>  
>>  	printk("%lu pages RAM\n", total);
>> -- 
>> 2.15.1
>> 
>
>-- 
>Michal Hocko
>SUSE Labs

-- 
Wei Yang
Help you, Help me

  reply	other threads:[~2018-11-29  9:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 21:08 Wei Yang
2018-11-28 22:07 ` Andrew Morton
2018-11-29  1:52   ` Wei Yang
2018-11-29  8:17 ` Michal Hocko
2018-11-29  9:32   ` Wei Yang [this message]
2018-11-29 15:04   ` Wei Yang
2018-11-29 15:49     ` Michal Hocko
2018-11-29 16:05       ` Wei Yang
2018-11-29 16:18         ` Michal Hocko
2018-11-29 23:49           ` Wei Yang
2018-11-29 23:55 ` [PATCH v2] " Wei Yang
2018-11-30  8:17   ` Michal Hocko
2018-11-30  8:54   ` osalvador

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181129093249.ztcbo5foncee74zg@master \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jweiner@fb.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox