linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Zhen <zhenzhang.zhang@huawei.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: David Rientjes <rientjes@google.com>,
	shaohui.zheng@intel.com, mgorman@suse.de, mingo@redhat.com,
	Linux MM <linux-mm@kvack.org>,
	linux-kernel@vger.kernel.org, wangnan0@huawei.com,
	akpm@linux-foundation.org
Subject: Re: [PATCH] memory hotplug: update the variables after memory removed
Date: Tue, 29 Jul 2014 14:55:32 +0800	[thread overview]
Message-ID: <53D74564.90302@huawei.com> (raw)
In-Reply-To: <53D6DB9C.7030109@intel.com>

On 2014/7/29 7:24, Dave Hansen wrote:
> On 07/28/2014 04:12 PM, David Rientjes wrote:
>> I agree, but I'm not sure the suggestion is any better than the patch.  I 
>> think it would be better to just figure out whether anything needs to be 
>> updated in the caller and then call a generic function.
>>
>> So in arch_add_memory(), do
>>
>> 	end_pfn = PFN_UP(start + size);
>> 	if (end_pfn > max_pfn)
>> 		update_end_of_memory_vars(end_pfn);
>>
>> and in arch_remove_memory(),
>>
>> 	end_pfn = PFN_UP(start);
>> 	if (end_pfn < max_pfn)
>> 		update_end_of_memory_vars(end_pfn);
>>
>> and then update_end_of_memory_vars() becomes a three-liner.
> 
> That does look better than my suggestion, generally.
> 
> It is broken in the remove case, though.  In your example, the memory
> being removed is assumed to be coming from the end of memory, and that
> isn't always the case.  I think you need something like:
> 
> 	if ((max_pfn >= start_pfn) && (max_pfn < end_pfn)
> 		update_end_of_memory_vars(start);
> 
> But, yeah, that's a lot better than new functions.
> 
Thanks for your comments!

I will change according to your suggestions.
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 
> 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2014-07-29  6:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1406550617-19556-1-git-send-email-zhenzhang.zhang@huawei.com>
2014-07-28 12:32 ` [PATCH] memory hotplug: update the variables after memory removed Zhang Zhen
2014-07-28 15:12   ` Dave Hansen
2014-07-28 23:12     ` David Rientjes
2014-07-28 23:24       ` Dave Hansen
2014-07-29  6:55         ` Zhang Zhen [this message]

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=53D74564.90302@huawei.com \
    --to=zhenzhang.zhang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rientjes@google.com \
    --cc=shaohui.zheng@intel.com \
    --cc=wangnan0@huawei.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;
as well as URLs for NNTP newsgroup(s).