From: Mel Gorman <mel@csn.ul.ie>
To: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Linux Kernel ML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>, Andrew Morton <akpm@osdl.org>,
Christoph Lameter <clameter@sgi.com>
Subject: Re: [RFC] memory hotremove patch take 2 [04/10] (isolate all free pages)
Date: Thu, 10 May 2007 17:42:54 +0100 (IST) [thread overview]
Message-ID: <Pine.LNX.4.64.0705101737500.6987@skynet.skynet.ie> (raw)
In-Reply-To: <20070509120434.B90E.Y-GOTO@jp.fujitsu.com>
On Wed, 9 May 2007, Yasunori Goto wrote:
> Isolate all freed pages (means in buddy_list) in the range.
> See page_buddy() and free_one_page() function if unsure.
>
> Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
>
> include/linux/page_isolation.h | 1
> mm/page_alloc.c | 45 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 46 insertions(+)
>
> Index: current_test/mm/page_alloc.c
> ===================================================================
> --- current_test.orig/mm/page_alloc.c 2007-05-08 15:08:04.000000000 +0900
> +++ current_test/mm/page_alloc.c 2007-05-08 15:08:26.000000000 +0900
> @@ -4411,6 +4411,51 @@ free_all_isolated_pages(struct isolation
> }
> }
>
> +/*
> + * Isolate already freed pages.
> + */
> +int
> +capture_isolate_freed_pages(struct isolation_info *info)
> +{
> + struct zone *zone;
> + unsigned long pfn;
> + struct page *page;
> + int order, order_size;
> + int nr_pages = 0;
> + unsigned long last_pfn = info->end_pfn - 1;
> + pfn = info->start_pfn;
> + if (!pfn_valid(pfn))
> + return -EINVAL;
This may lead to boundary cases where pages cannot be captured at the
start and end of non-aligned zones due to memory holes.
> + zone = info->zone;
> + if ((zone != page_zone(pfn_to_page(pfn))) ||
> + (zone != page_zone(pfn_to_page(last_pfn))))
> + return -EINVAL;
Is this check really necessary? Surely a caller to
capture_isolate_freed_pages() will have already made all the necessary
checks when adding the struct insolation_info ?
> + drain_all_pages();
> + spin_lock(&zone->lock);
> + while (pfn < info->end_pfn) {
> + if (!pfn_valid(pfn)) {
> + pfn++;
> + continue;
> + }
> + page = pfn_to_page(pfn);
> + /* See page_is_buddy() */
> + if (page_count(page) == 0 && PageBuddy(page)) {
If PageBuddy is set it's free, you shouldn't have to check the page_count.
> + order = page_order(page);
> + order_size = 1 << order;
> + zone->free_area[order].nr_free--;
> + __mod_zone_page_state(zone, NR_FREE_PAGES, -order_size);
> + list_del(&page->lru);
> + rmv_page_order(page);
> + isolate_page_nolock(info, page, order);
> + nr_pages += order_size;
> + pfn += order_size;
> + } else {
> + pfn++;
> + }
> + }
> + spin_unlock(&zone->lock);
> + return nr_pages;
> +}
> #endif /* CONFIG_PAGE_ISOLATION */
>
This is all similar to move_freepages() other than the locking part. It
would be worth checking if there is code that could be shared or at least
have similar styles.
>
> Index: current_test/include/linux/page_isolation.h
> ===================================================================
> --- current_test.orig/include/linux/page_isolation.h 2007-05-08 15:08:04.000000000 +0900
> +++ current_test/include/linux/page_isolation.h 2007-05-08 15:08:27.000000000 +0900
> @@ -40,6 +40,7 @@ extern void free_isolation_info(struct i
> extern void unuse_all_isolated_pages(struct isolation_info *info);
> extern void free_all_isolated_pages(struct isolation_info *info);
> extern void drain_all_pages(void);
> +extern int capture_isolate_freed_pages(struct isolation_info *info);
>
> #else
>
>
> --
> Yasunori Goto
>
>
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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:[~2007-05-10 16:42 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-09 2:59 [RFC] memory hotremove patch take 2 [00/10] Yasunori Goto
2007-05-09 3:10 ` [RFC] memory hotremove patch take 2 [01/10] (counter of removable page) Yasunori Goto
2007-05-10 12:46 ` Mel Gorman
2007-05-10 13:44 ` Andi Kleen
2007-05-11 1:08 ` KAMEZAWA Hiroyuki
2007-05-10 18:00 ` Christoph Lameter
2007-05-11 1:09 ` KAMEZAWA Hiroyuki
2007-05-09 3:10 ` [RFC] memory hotremove patch take 2 [02/10] (make page unused) Yasunori Goto
2007-05-10 15:34 ` Mel Gorman
2007-05-11 0:47 ` KAMEZAWA Hiroyuki
2007-05-10 18:04 ` Christoph Lameter
2007-05-11 0:49 ` KAMEZAWA Hiroyuki
2007-05-09 3:10 ` [RFC] memory hotremove patch take 2 [03/10] (drain all pages) Yasunori Goto
2007-05-10 15:35 ` Mel Gorman
2007-05-11 0:53 ` KAMEZAWA Hiroyuki
2007-05-10 18:07 ` Christoph Lameter
2007-05-11 0:54 ` KAMEZAWA Hiroyuki
2007-05-09 3:10 ` [RFC] memory hotremove patch take 2 [04/10] (isolate all free pages) Yasunori Goto
2007-05-10 16:42 ` Mel Gorman [this message]
2007-05-11 0:58 ` KAMEZAWA Hiroyuki
2007-05-10 18:07 ` Christoph Lameter
2007-05-09 3:11 ` [RFC] memory hotremove patch take 2 [05/10] (make basic remove code) Yasunori Goto
2007-05-10 18:09 ` Christoph Lameter
2007-05-11 1:05 ` KAMEZAWA Hiroyuki
2007-05-09 3:11 ` [RFC] memory hotremove patch take 2 [06/10] (ia64's remove_memory code) Yasunori Goto
2007-05-09 3:11 ` [RFC] memory hotremove patch take 2 [07/10] (delay freeing anon_vma) Yasunori Goto
2007-05-09 3:12 ` [RFC] memory hotremove patch take 2 [08/10] (memap init alignment) Yasunori Goto
2007-05-09 3:12 ` [RFC] memory hotremove patch take 2 [09/10] (direct isolation for remove) Yasunori Goto
2007-05-09 3:12 ` [RFC] memory hotremove patch take 2 [10/10] (retry swap-in page) Yasunori Goto
2007-05-09 3:26 ` KAMEZAWA Hiroyuki
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=Pine.LNX.4.64.0705101737500.6987@skynet.skynet.ie \
--to=mel@csn.ul.ie \
--cc=akpm@osdl.org \
--cc=clameter@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=y-goto@jp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox