From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andrew Morton <akpm@linux-foundation.org>,
Michal Nazarewicz <mina86@mina86.com>, Mel Gorman <mel@csn.ul.ie>,
Wen Congyang <wency@cn.fujitsu.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [RFC v2] memory-hotplug: remove MIGRATE_ISOLATE from free_area->free_list
Date: Thu, 06 Sep 2012 16:57:30 +0800 [thread overview]
Message-ID: <5048657A.7060004@cn.fujitsu.com> (raw)
In-Reply-To: <20120906081818.GC16231@bbox>
On 09/06/2012 04:18 PM, Minchan Kim wrote:
> Hello Lai,
>
> On Thu, Sep 06, 2012 at 04:14:51PM +0800, Lai Jiangshan wrote:
>> On 09/06/2012 10:53 AM, Minchan Kim wrote:
>>> Normally, MIGRATE_ISOLATE type is used for memory-hotplug.
>>> But it's irony type because the pages isolated would exist
>>> as free page in free_area->free_list[MIGRATE_ISOLATE] so people
>>> can think of it as allocatable pages but it is *never* allocatable.
>>> It ends up confusing NR_FREE_PAGES vmstat so it would be
>>> totally not accurate so some of place which depend on such vmstat
>>> could reach wrong decision by the context.
>>>
>>> There were already report about it.[1]
>>> [1] 702d1a6e, memory-hotplug: fix kswapd looping forever problem
>>>
>>> Then, there was other report which is other problem.[2]
>>> [2] http://www.spinics.net/lists/linux-mm/msg41251.html
>>>
>>> I believe it can make problems in future, too.
>>> So I hope removing such irony type by another design.
>>>
>>> I hope this patch solves it and let's revert [1] and doesn't need [2].
>>>
>>> * Changelog v1
>>> * Fix from Michal's many suggestion
>>>
>>> Cc: Michal Nazarewicz <mina86@mina86.com>
>>> Cc: Mel Gorman <mel@csn.ul.ie>
>>> Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>>> Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>>> Cc: Wen Congyang <wency@cn.fujitsu.com>
>>> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> Signed-off-by: Minchan Kim <minchan@kernel.org>
>>> ---
>>
>>> @@ -180,30 +287,35 @@ int undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
>>> * all pages in [start_pfn...end_pfn) must be in the same zone.
>>> * zone->lock must be held before call this.
>>> *
>>> - * Returns 1 if all pages in the range are isolated.
>>> + * Returns true if all pages in the range are isolated.
>>> */
>>> -static int
>>> -__test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)
>>> +static bool
>>> +__test_page_isolated_in_pageblock(unsigned long start_pfn, unsigned long end_pfn)
>>> {
>>> + unsigned long pfn, next_pfn;
>>> struct page *page;
>>>
>>> - while (pfn < end_pfn) {
>>> - if (!pfn_valid_within(pfn)) {
>>> - pfn++;
>>> - continue;
>>> - }
>>> - page = pfn_to_page(pfn);
>>> - if (PageBuddy(page))
>>> - pfn += 1 << page_order(page);
>>> - else if (page_count(page) == 0 &&
>>> - page_private(page) == MIGRATE_ISOLATE)
>>> - pfn += 1;
>>> - else
>>> - break;
>>> + list_for_each_entry(page, &isolated_pages, lru) {
>>
>>> + if (&page->lru == &isolated_pages)
>>> + return false;
>>
>> what's the mean of this line?
>
> I just copied it from Michal's code but It seem to be not needed.
> I will remove it in next spin.
>
>>
>>> + pfn = page_to_pfn(page);
>>> + if (pfn >= end_pfn)
>>> + return false;
>>> + if (pfn >= start_pfn)
>>> + goto found;
this test is wrong.
if ((pfn <= start_pfn) && (start_pfn < pfn + (1UL << page_order(page))))
goto found;
>>> + }
>>> + return false;
>>> +
>>> + list_for_each_entry_continue(page, &isolated_pages, lru) {
>>> + if (page_to_pfn(page) != next_pfn)
>>> + return false;
>>
>> where is next_pfn init-ed?
>
> by "goto found"
don't goto inner label.
move the found label up:
+
+found:
+ next_pfn = page_to_pfn(page);
+ list_for_each_entry_from(page, &isolated_pages, lru) {
+ if (page_to_pfn(page) != next_pfn)
+ return false;
+ pfn = page_to_pfn(page);
+ next_pfn = pfn + (1UL << page_order(page));
+ if (next_pfn >= end_pfn)
+ return true;
}
--
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: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andrew Morton <akpm@linux-foundation.org>,
Michal Nazarewicz <mina86@mina86.com>, Mel Gorman <mel@csn.ul.ie>,
Wen Congyang <wency@cn.fujitsu.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [RFC v2] memory-hotplug: remove MIGRATE_ISOLATE from free_area->free_list
Date: Thu, 06 Sep 2012 16:57:30 +0800 [thread overview]
Message-ID: <5048657A.7060004@cn.fujitsu.com> (raw)
In-Reply-To: <20120906081818.GC16231@bbox>
On 09/06/2012 04:18 PM, Minchan Kim wrote:
> Hello Lai,
>
> On Thu, Sep 06, 2012 at 04:14:51PM +0800, Lai Jiangshan wrote:
>> On 09/06/2012 10:53 AM, Minchan Kim wrote:
>>> Normally, MIGRATE_ISOLATE type is used for memory-hotplug.
>>> But it's irony type because the pages isolated would exist
>>> as free page in free_area->free_list[MIGRATE_ISOLATE] so people
>>> can think of it as allocatable pages but it is *never* allocatable.
>>> It ends up confusing NR_FREE_PAGES vmstat so it would be
>>> totally not accurate so some of place which depend on such vmstat
>>> could reach wrong decision by the context.
>>>
>>> There were already report about it.[1]
>>> [1] 702d1a6e, memory-hotplug: fix kswapd looping forever problem
>>>
>>> Then, there was other report which is other problem.[2]
>>> [2] http://www.spinics.net/lists/linux-mm/msg41251.html
>>>
>>> I believe it can make problems in future, too.
>>> So I hope removing such irony type by another design.
>>>
>>> I hope this patch solves it and let's revert [1] and doesn't need [2].
>>>
>>> * Changelog v1
>>> * Fix from Michal's many suggestion
>>>
>>> Cc: Michal Nazarewicz <mina86@mina86.com>
>>> Cc: Mel Gorman <mel@csn.ul.ie>
>>> Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>>> Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>>> Cc: Wen Congyang <wency@cn.fujitsu.com>
>>> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> Signed-off-by: Minchan Kim <minchan@kernel.org>
>>> ---
>>
>>> @@ -180,30 +287,35 @@ int undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
>>> * all pages in [start_pfn...end_pfn) must be in the same zone.
>>> * zone->lock must be held before call this.
>>> *
>>> - * Returns 1 if all pages in the range are isolated.
>>> + * Returns true if all pages in the range are isolated.
>>> */
>>> -static int
>>> -__test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)
>>> +static bool
>>> +__test_page_isolated_in_pageblock(unsigned long start_pfn, unsigned long end_pfn)
>>> {
>>> + unsigned long pfn, next_pfn;
>>> struct page *page;
>>>
>>> - while (pfn < end_pfn) {
>>> - if (!pfn_valid_within(pfn)) {
>>> - pfn++;
>>> - continue;
>>> - }
>>> - page = pfn_to_page(pfn);
>>> - if (PageBuddy(page))
>>> - pfn += 1 << page_order(page);
>>> - else if (page_count(page) == 0 &&
>>> - page_private(page) == MIGRATE_ISOLATE)
>>> - pfn += 1;
>>> - else
>>> - break;
>>> + list_for_each_entry(page, &isolated_pages, lru) {
>>
>>> + if (&page->lru == &isolated_pages)
>>> + return false;
>>
>> what's the mean of this line?
>
> I just copied it from Michal's code but It seem to be not needed.
> I will remove it in next spin.
>
>>
>>> + pfn = page_to_pfn(page);
>>> + if (pfn >= end_pfn)
>>> + return false;
>>> + if (pfn >= start_pfn)
>>> + goto found;
this test is wrong.
if ((pfn <= start_pfn) && (start_pfn < pfn + (1UL << page_order(page))))
goto found;
>>> + }
>>> + return false;
>>> +
>>> + list_for_each_entry_continue(page, &isolated_pages, lru) {
>>> + if (page_to_pfn(page) != next_pfn)
>>> + return false;
>>
>> where is next_pfn init-ed?
>
> by "goto found"
don't goto inner label.
move the found label up:
+
+found:
+ next_pfn = page_to_pfn(page);
+ list_for_each_entry_from(page, &isolated_pages, lru) {
+ if (page_to_pfn(page) != next_pfn)
+ return false;
+ pfn = page_to_pfn(page);
+ next_pfn = pfn + (1UL << page_order(page));
+ if (next_pfn >= end_pfn)
+ return true;
}
next prev parent reply other threads:[~2012-09-06 8:55 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 2:53 [RFC v2] memory-hotplug: remove MIGRATE_ISOLATE from free_area->free_list Minchan Kim
2012-09-06 2:53 ` Minchan Kim
2012-09-06 8:14 ` Lai Jiangshan
2012-09-06 8:14 ` Lai Jiangshan
2012-09-06 8:18 ` Minchan Kim
2012-09-06 8:18 ` Minchan Kim
2012-09-06 8:57 ` Lai Jiangshan [this message]
2012-09-06 8:57 ` Lai Jiangshan
2012-09-06 12:51 ` Michal Nazarewicz
2012-09-06 9:01 ` Lai Jiangshan
2012-09-06 9:01 ` Lai Jiangshan
2012-09-06 12:56 ` Michal Nazarewicz
2012-09-06 12:48 ` Michal Nazarewicz
2012-09-06 12:48 ` Michal Nazarewicz
2012-09-06 16:34 ` Bartlomiej Zolnierkiewicz
2012-09-06 16:34 ` Bartlomiej Zolnierkiewicz
2012-09-11 0:49 ` Minchan Kim
2012-09-11 0:49 ` Minchan Kim
2012-09-13 14:21 ` Bartlomiej Zolnierkiewicz
2012-09-13 14:21 ` Bartlomiej Zolnierkiewicz
2012-09-14 1:15 ` Minchan Kim
2012-09-14 1:15 ` Minchan Kim
2012-09-07 7:28 ` Wen Congyang
2012-09-07 7:28 ` Wen Congyang
2012-09-11 0:52 ` Minchan Kim
2012-09-11 0:52 ` Minchan Kim
2012-09-11 1:37 ` Wen Congyang
2012-09-11 1:37 ` Wen Congyang
2012-09-11 6:16 ` Minchan Kim
2012-09-11 6:16 ` Minchan Kim
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=5048657A.7060004@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=mina86@mina86.com \
--cc=minchan@kernel.org \
--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.