linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Andy Whitcroft <apw@shadowen.org>
Cc: kosaki.motohiro@jp.fujitsu.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Mel Gorman <mel@csn.ul.ie>
Subject: Re: [PATCH 4/4] capture pages freed during direct reclaim for allocation by the reclaimer
Date: Wed, 02 Jul 2008 21:01:59 +0900	[thread overview]
Message-ID: <20080702182909.D163.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)
In-Reply-To: <1214935122-20828-5-git-send-email-apw@shadowen.org>

Hi Andy,

I feel this is interesting patch.

but I'm worry about it become increase OOM occur.
What do you think?

and, Why don't you make patch against -mm tree?


> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index d73e1e1..1ac703d 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -410,6 +410,51 @@ static inline int page_is_buddy(struct page *page, struct page *buddy,
>   * -- wli
>   */
>  
> +static inline void __capture_one_page(struct list_head *capture_list,
> +		struct page *page, struct zone *zone, unsigned int order)
> +{
> +	unsigned long page_idx;
> +	unsigned long order_size = 1UL << order;
> +
> +	if (unlikely(PageCompound(page)))
> +		destroy_compound_page(page, order);
> +
> +	page_idx = page_to_pfn(page) & ((1 << MAX_ORDER) - 1);
> +
> +	VM_BUG_ON(page_idx & (order_size - 1));
> +	VM_BUG_ON(bad_range(zone, page));
> +
> +	while (order < MAX_ORDER-1) {
> +		unsigned long combined_idx;
> +		struct page *buddy;
> +
> +		buddy = __page_find_buddy(page, page_idx, order);
> +		if (!page_is_buddy(page, buddy, order))
> +			break;
> +
> +		/* Our buddy is free, merge with it and move up one order. */
> +		list_del(&buddy->lru);
> +		if (PageBuddyCapture(buddy)) {
> +			buddy->buddy_free = 0;
> +			__ClearPageBuddyCapture(buddy);
> +		} else {
> +			zone->free_area[order].nr_free--;
> +			__mod_zone_page_state(zone,
> +					NR_FREE_PAGES, -(1UL << order));
> +		}
> +		rmv_page_order(buddy);
> +		combined_idx = __find_combined_index(page_idx, order);
> +		page = page + (combined_idx - page_idx);
> +		page_idx = combined_idx;
> +		order++;
> +	}
> +	set_page_order(page, order);
> +	__SetPageBuddyCapture(page);
> +	page->buddy_free = capture_list;
> +
> +	list_add(&page->lru, capture_list);
> +}

if we already have enough size page, 
shoudn't we release page to buddy list?

otherwise, increase oom risk.
or, Am I misunderstanding?


>  static inline void __free_one_page(struct page *page,
>  		struct zone *zone, unsigned int order)
>  {
> @@ -433,6 +478,12 @@ static inline void __free_one_page(struct page *page,
>  		buddy = __page_find_buddy(page, page_idx, order);
>  		if (!page_is_buddy(page, buddy, order))
>  			break;
> +		if (PageBuddyCapture(buddy)) {
> +			__mod_zone_page_state(zone,
> +					NR_FREE_PAGES, -(1UL << order));
> +			return __capture_one_page(buddy->buddy_free,
> +							page, zone, order);
> +		}

shouldn't you make captured page's zonestat?
otherwise, administrator can't trouble shooting.


>  	/* Can pages be swapped as part of reclaim? */
> @@ -78,6 +80,12 @@ struct scan_control {
>  			unsigned long *scanned, int order, int mode,
>  			struct zone *z, struct mem_cgroup *mem_cont,
>  			int active);
> +
> +	/* Captured page. */
> +	struct page **capture;
> +	
> +	/* Nodemask for acceptable allocations. */
> +	nodemask_t *nodemask;
>  };

please more long comment.
anybody think about scan_control is reclaim purpose structure.
So, probably they think "Why is this member needed?".




> @@ -1314,8 +1360,14 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
>  	unsigned long lru_pages = 0;
>  	struct zoneref *z;
>  	struct zone *zone;
> +	struct zone *preferred_zone;
>  	enum zone_type high_zoneidx = gfp_zone(sc->gfp_mask);
>  
> +	/* This should never fail as we should be scanning a real zonelist. */
> +	(void)first_zones_zonelist(zonelist, high_zoneidx, sc->nodemask,
> +							&preferred_zone);

nit.
(void) is unnecessary.



--
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:[~2008-07-02 12:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 17:58 [RFC PATCH 0/4] Reclaim page capture v1 Andy Whitcroft
2008-07-01 17:58 ` [PATCH 1/4] pull out the page pre-release and sanity check logic for reuse Andy Whitcroft
2008-07-01 17:58 ` [PATCH 2/4] pull out zone cpuset and watermark checks " Andy Whitcroft
2008-07-02  8:06   ` KOSAKI Motohiro
2008-07-01 17:58 ` [PATCH 3/4] buddy: explicitly identify buddy field use in struct page Andy Whitcroft
2008-07-01 17:58 ` [PATCH 4/4] capture pages freed during direct reclaim for allocation by the reclaimer Andy Whitcroft
2008-07-02 12:01   ` KOSAKI Motohiro [this message]
2008-07-02 14:44     ` Andy Whitcroft
2008-09-03 18:44 [RFC PATCH 0/4] Reclaim page capture v2 Andy Whitcroft
2008-09-03 18:44 ` [PATCH 4/4] capture pages freed during direct reclaim for allocation by the reclaimer Andy Whitcroft
2008-09-03 20:35   ` Christoph Lameter
2008-09-03 20:53   ` Andy Whitcroft
2008-09-03 21:00     ` Christoph Lameter
2008-09-04  6:38       ` Peter Zijlstra
2008-09-04 14:18         ` Christoph Lameter
2008-09-04  8:11       ` KOSAKI Motohiro
2008-09-04  8:58       ` Andy Whitcroft
2008-09-04  7:20     ` Peter Zijlstra
2008-09-04 11:35       ` Andy Whitcroft
2008-09-04  7:59     ` KOSAKI Motohiro
2008-09-04 14:44       ` Andy Whitcroft
2008-09-05  1:52         ` KOSAKI Motohiro
2008-09-05 10:19 [PATCH 0/4] Reclaim page capture v3 Andy Whitcroft
2008-09-05 10:20 ` [PATCH 4/4] capture pages freed during direct reclaim for allocation by the reclaimer Andy Whitcroft
2008-10-01 12:30 [PATCH 0/4] Reclaim page capture v4 Andy Whitcroft
2008-10-01 12:31 ` [PATCH 4/4] capture pages freed during direct reclaim for allocation by the reclaimer Andy Whitcroft
2008-10-01 15:01   ` Christoph Lameter
2008-10-02 14:35     ` Andy Whitcroft
2008-10-02 16:29       ` Christoph Lameter
2008-10-03  3:41         ` KOSAKI Motohiro
2008-10-03 12:37           ` Christoph Lameter
2008-10-02  7:24   ` KAMEZAWA Hiroyuki
2008-10-02 15:02     ` Andy Whitcroft

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=20080702182909.D163.KOSAKI.MOTOHIRO@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    /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