From: Wen Congyang <wency@cn.fujitsu.com>
To: Jianguo Wu <wujianguo106@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org, Jiang Liu <liuj97@gmail.com>,
Len Brown <len.brown@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
rjw@sisk.pl, Lai Jiangshan <laijs@cn.fujitsu.com>,
David Rientjes <rientjes@google.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Christoph Lameter <cl@linux.com>,
Minchan Kim <minchan.kim@gmail.com>,
Dave Hansen <dave@linux.vnet.ibm.com>, Mel Gorman <mel@csn.ul.ie>
Subject: Re: [Patch v4 3/8] memory-hotplug: fix NR_FREE_PAGES mismatch
Date: Thu, 01 Nov 2012 11:00:07 +0800 [thread overview]
Message-ID: <5091E5B7.80308@cn.fujitsu.com> (raw)
In-Reply-To: <50912A85.5090808@gmail.com>
At 10/31/2012 09:41 PM, Jianguo Wu Wrote:
> On 2012/10/31 19:23, Wen Congyang wrote:
>> NR_FREE_PAGES will be wrong after offlining pages. We add/dec
>> NR_FREE_PAGES like this now:
>>
>> 1. move all pages in buddy system to MIGRATE_ISOLATE, and dec NR_FREE_PAGES
>>
>> 2. don't add NR_FREE_PAGES when it is freed and the migratetype is
>> MIGRATE_ISOLATE
>>
>> 3. dec NR_FREE_PAGES when offlining isolated pages.
>>
>> 4. add NR_FREE_PAGES when undoing isolate pages.
>>
>> When we come to step 3, all pages are in MIGRATE_ISOLATE list, and
>> NR_FREE_PAGES are right. When we come to step4, all pages are not in
>> buddy system, so we don't change NR_FREE_PAGES in this step, but we change
>> NR_FREE_PAGES in step3. So NR_FREE_PAGES is wrong after offlining pages.
>> So there is no need to change NR_FREE_PAGES in step3.
>>
>> This patch also fixs a problem in step2: if the migratetype is
>> MIGRATE_ISOLATE, we should not add NR_FRR_PAGES when we remove pages from
>> pcppages.
>>
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>> Cc: David Rientjes <rientjes@google.com>
>> Cc: Jiang Liu <liuj97@gmail.com>
>> Cc: Len Brown <len.brown@intel.com>
>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Cc: Paul Mackerras <paulus@samba.org>
>> Cc: Christoph Lameter <cl@linux.com>
>> Cc: Minchan Kim <minchan.kim@gmail.com>
>> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>> Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>> Cc: Dave Hansen <dave@linux.vnet.ibm.com>
>> Cc: Mel Gorman <mel@csn.ul.ie>
>> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>> ---
>> mm/page_alloc.c | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 5b74de6..a7cd2d1 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -667,11 +667,13 @@ static void free_pcppages_bulk(struct zone *zone, int count,
>> /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
>> __free_one_page(page, zone, 0, mt);
>> trace_mm_page_pcpu_drain(page, 0, mt);
>> - if (is_migrate_cma(mt))
>> - __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 1);
>> + if (likely(mt != MIGRATE_ISOLATE)) {
>
> Hi Congyang,
> I think mt != MIGRATE_ISOLATE is always true here,
> page from PCP's migratetype < MIGRATE_PCPTYPES.
> When isolate page, we change pageblock's migratetype to MIGRATE_ISOLATE,
> but set_freepage_migratetype() isn't called.
> Maybe we can use mt = get_pageblock_migratetype() here ?
Yes, you are right. I have sent a fix patch.
Thanks for pointing it out.
Wen Congyang
>
> Thanks,
> Jianguo Wu.
>
>> + __mod_zone_page_state(zone, NR_FREE_PAGES, 1);
>> + if (is_migrate_cma(mt))
>> + __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 1);
>> + }
>> } while (--to_free && --batch_free && !list_empty(list));
>> }
>> - __mod_zone_page_state(zone, NR_FREE_PAGES, count);
>> spin_unlock(&zone->lock);
>> }
>>
>> @@ -5987,8 +5989,6 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
>> list_del(&page->lru);
>> rmv_page_order(page);
>> zone->free_area[order].nr_free--;
>> - __mod_zone_page_state(zone, NR_FREE_PAGES,
>> - - (1UL << order));
>> for (i = 0; i < (1 << order); i++)
>> SetPageReserved((page+i));
>> pfn += (1 << order);
>>
>
>
--
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>
next prev parent reply other threads:[~2012-11-01 2:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-31 11:23 [Patch v4 0/8] bugfix for memory hotplug Wen Congyang
2012-10-31 11:23 ` [Patch v4 1/8] memory hotplug: suppress "Device memoryX does not have a release() function" warning Wen Congyang
2012-10-31 11:23 ` [Patch v4 2/8] memory-hotplug: auto offline page_cgroup when onlining memory block failed Wen Congyang
2012-10-31 11:23 ` [Patch v4 3/8] memory-hotplug: fix NR_FREE_PAGES mismatch Wen Congyang
2012-10-31 13:41 ` Jianguo Wu
2012-11-01 3:00 ` Wen Congyang [this message]
2012-11-01 2:55 ` [PATCH] memory-hotplug: fix NR_FREE_PAGES mismatch's fix Wen Congyang
2012-10-31 11:23 ` [Patch v4 4/8] numa: convert static memory to dynamically allocated memory for per node device Wen Congyang
2012-10-31 11:23 ` [Patch v4 5/8] suppress "Device nodeX does not have a release() function" warning Wen Congyang
2012-10-31 11:23 ` [Patch v4 6/8] clear the memory to store struct page Wen Congyang
2012-10-31 11:23 ` [Patch v4 7/8] memory-hotplug: current hwpoison doesn't support memory offline Wen Congyang
2012-10-31 11:23 ` [Patch v4 8/8] memory-hotplug: allocate zone's pcp before onlining pages Wen Congyang
2012-10-31 11:32 ` [Patch v4 0/8] bugfix for memory hotplug 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=5091E5B7.80308@cn.fujitsu.com \
--to=wency@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=cl@linux.com \
--cc=dave@linux.vnet.ibm.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liuj97@gmail.com \
--cc=mel@csn.ul.ie \
--cc=minchan.kim@gmail.com \
--cc=paulus@samba.org \
--cc=rientjes@google.com \
--cc=rjw@sisk.pl \
--cc=wujianguo106@gmail.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).