From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: wency@cn.fujitsu.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, rientjes@google.com,
liuj97@gmail.com, len.brown@intel.com, benh@kernel.crashing.org,
paulus@samba.org, minchan.kim@gmail.com,
kosaki.motohiro@jp.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com,
Christoph Lameter <cl@linux.com>
Subject: Re: [PATCH v2 2/5] memory-hotplug: update mce_bad_pages when removing the memory
Date: Fri, 19 Oct 2012 06:42:46 -0700 [thread overview]
Message-ID: <508158D6.4040806@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121018152008.ada8fea5.akpm@linux-foundation.org>
On 10/18/2012 03:20 PM, Andrew Morton wrote:
> On Wed, 17 Oct 2012 08:09:55 -0700
> Dave Hansen <dave@linux.vnet.ibm.com> wrote:
>>> +#ifdef CONFIG_MEMORY_FAILURE
>>> +static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
>>> +{
>>> + int i;
>>> +
>>> + if (!memmap)
>>> + return;
>>
>> I guess free_section_usemap() does the same thing.
>
> What does this observation mean?
sparse_remove_one_section() has an if(ms->section_mem_map) statement.
Inside that if() block is the only place in the function where 'memmap'
can get set.
Currently, sparse_remove_one_section() calls in to free_section_usemap()
ouside of that if() block. With this patch new call to
clear_hwpoisoned_pages() is done in the same place, both passing 'memmap'.
However, both free_section_usemap() and clear_hwpoisoned_pages() check
'memmap' for NULL and immediately return if so. That's a bit silly
since it could hide garbage coming back from sparse_decode_mem_map().
Seems like we should just call them both inside that if() block, or
reorganize sparse_remove_one_section(), maybe like this:
void sparse_remove_one_section(struct zone *zone, struct mem_section *ms)
{
struct page *memmap = NULL;
unsigned long *usemap = NULL;
if (!ms->section_mem_map)
return;
usemap = ms->pageblock_flags;
memmap = sparse_decode_mem_map(ms->section_mem_map,
__section_nr(ms));
ms->section_mem_map = 0;
ms->pageblock_flags = NULL;
free_section_usemap(memmap, usemap);
clear_hwpoisoned_pages(usemap, ...);
}
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: wency@cn.fujitsu.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, rientjes@google.com,
liuj97@gmail.com, len.brown@intel.com, benh@kernel.crashing.org,
paulus@samba.org, minchan.kim@gmail.com,
kosaki.motohiro@jp.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com,
Christoph Lameter <cl@linux.com>
Subject: Re: [PATCH v2 2/5] memory-hotplug: update mce_bad_pages when removing the memory
Date: Fri, 19 Oct 2012 06:42:46 -0700 [thread overview]
Message-ID: <508158D6.4040806@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121018152008.ada8fea5.akpm@linux-foundation.org>
On 10/18/2012 03:20 PM, Andrew Morton wrote:
> On Wed, 17 Oct 2012 08:09:55 -0700
> Dave Hansen <dave@linux.vnet.ibm.com> wrote:
>>> +#ifdef CONFIG_MEMORY_FAILURE
>>> +static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
>>> +{
>>> + int i;
>>> +
>>> + if (!memmap)
>>> + return;
>>
>> I guess free_section_usemap() does the same thing.
>
> What does this observation mean?
sparse_remove_one_section() has an if(ms->section_mem_map) statement.
Inside that if() block is the only place in the function where 'memmap'
can get set.
Currently, sparse_remove_one_section() calls in to free_section_usemap()
ouside of that if() block. With this patch new call to
clear_hwpoisoned_pages() is done in the same place, both passing 'memmap'.
However, both free_section_usemap() and clear_hwpoisoned_pages() check
'memmap' for NULL and immediately return if so. That's a bit silly
since it could hide garbage coming back from sparse_decode_mem_map().
Seems like we should just call them both inside that if() block, or
reorganize sparse_remove_one_section(), maybe like this:
void sparse_remove_one_section(struct zone *zone, struct mem_section *ms)
{
struct page *memmap = NULL;
unsigned long *usemap = NULL;
if (!ms->section_mem_map)
return;
usemap = ms->pageblock_flags;
memmap = sparse_decode_mem_map(ms->section_mem_map,
__section_nr(ms));
ms->section_mem_map = 0;
ms->pageblock_flags = NULL;
free_section_usemap(memmap, usemap);
clear_hwpoisoned_pages(usemap, ...);
}
next prev parent reply other threads:[~2012-10-19 13:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-17 12:08 [PATCH v2 0/5] bugfix for memory hotplug wency
2012-10-17 12:08 ` wency
2012-10-17 12:08 ` [PATCH v2 1/5] memory-hotplug: skip HWPoisoned page when offlining pages wency
2012-10-17 12:08 ` wency
2012-10-17 12:08 ` [PATCH v2 2/5] memory-hotplug: update mce_bad_pages when removing the memory wency
2012-10-17 12:08 ` wency
2012-10-17 15:09 ` Dave Hansen
2012-10-17 15:09 ` Dave Hansen
2012-10-18 22:20 ` Andrew Morton
2012-10-18 22:20 ` Andrew Morton
2012-10-19 13:42 ` Dave Hansen [this message]
2012-10-19 13:42 ` Dave Hansen
2012-10-17 12:08 ` [PATCH v2 3/5] memory-hotplug: auto offline page_cgroup when onlining memory block failed wency
2012-10-17 12:08 ` wency
2012-10-17 15:26 ` Wen Congyang
2012-10-17 15:26 ` Wen Congyang
2012-10-17 12:08 ` [PATCH v2 4/5] memory-hotplug: fix NR_FREE_PAGES mismatch wency
2012-10-17 12:08 ` wency
2012-10-17 12:08 ` [PATCH v2 5/5] memory-hotplug: allocate zone's pcp before onlining pages wency
2012-10-17 12:08 ` wency
2012-10-17 12:22 ` [PATCH v2 0/5] bugfix for memory hotplug Ni zhan Chen
2012-10-17 12:22 ` Ni zhan Chen
2012-10-17 15:31 ` Wen Congyang
2012-10-17 15:31 ` Wen Congyang
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=508158D6.4040806@linux.vnet.ibm.com \
--to=dave@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=cl@linux.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liuj97@gmail.com \
--cc=minchan.kim@gmail.com \
--cc=paulus@samba.org \
--cc=rientjes@google.com \
--cc=wency@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.