linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	Rik van Riel <riel@redhat.com>,
	Lee Schermerhorn <Lee.Schermerhorn@hp.com>,
	Nick Piggin <npiggin@suse.de>
Subject: Re: [RFC][PATCH] page reclaim throttle take2
Date: Tue, 26 Feb 2008 22:18:38 +0100	[thread overview]
Message-ID: <1204060718.6242.333.camel@lappy> (raw)
In-Reply-To: <20080226104647.FF26.KOSAKI.MOTOHIRO@jp.fujitsu.com>

On Tue, 2008-02-26 at 11:32 +0900, KOSAKI Motohiro wrote:

> Index: b/include/linux/mmzone.h
> ===================================================================
> --- a/include/linux/mmzone.h	2008-02-25 21:37:49.000000000 +0900
> +++ b/include/linux/mmzone.h	2008-02-26 10:12:12.000000000 +0900
> @@ -335,6 +335,9 @@ struct zone {
>  	unsigned long		spanned_pages;	/* total size, including holes */
>  	unsigned long		present_pages;	/* amount of memory (excluding holes) */
>  
> +
> +	atomic_t		nr_reclaimers;
> +	wait_queue_head_t	reclaim_throttle_waitq;
>  	/*
>  	 * rarely used fields:
>  	 */

Small nit, that extra blank line seems at the wrong end of the text
block :-)

> Index: b/mm/vmscan.c
> ===================================================================
> --- a/mm/vmscan.c	2008-02-25 21:37:49.000000000 +0900
> +++ b/mm/vmscan.c	2008-02-26 10:59:38.000000000 +0900
> @@ -1252,6 +1252,55 @@ static unsigned long shrink_zone(int pri
>  	return nr_reclaimed;
>  }
>  
> +
> +#define RECLAIM_LIMIT (3)
> +
> +static int do_shrink_zone_throttled(int priority, struct zone *zone,
> +				    struct scan_control *sc,
> +				    unsigned long *ret_reclaimed)
> +{
> +	u64 start_time;
> +	int ret = 0;
> +
> +	start_time = jiffies_64;
> +
> +	wait_event(zone->reclaim_throttle_waitq,
> +		   atomic_add_unless(&zone->nr_reclaimers, 1, RECLAIM_LIMIT));
> +
> +	/* more reclaim until needed? */
> +	if (scan_global_lru(sc) &&
> +	    !(current->flags & PF_KSWAPD) &&
> +	    time_after64(jiffies, start_time + HZ/10)) {
> +		if (zone_watermark_ok(zone, sc->order, 4*zone->pages_high,
> +				      MAX_NR_ZONES-1, 0)) {
> +			ret = -EAGAIN;
> +			goto out;
> +		}
> +	}
> +
> +	*ret_reclaimed += shrink_zone(priority, zone, sc);
> +
> +out:
> +	atomic_dec(&zone->nr_reclaimers);
> +	wake_up_all(&zone->reclaim_throttle_waitq);
> +
> +	return ret;
> +}

Would it be possible - and worthwhile - to make this FIFO fair?

--
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-02-26 21:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26  2:32 KOSAKI Motohiro
2008-02-26 21:18 ` Peter Zijlstra [this message]
2008-02-27  0:50   ` KAMEZAWA Hiroyuki
2008-02-27  4:26   ` KOSAKI Motohiro
2008-02-27  4:27     ` Balbir Singh
2008-02-27  4:45       ` KOSAKI Motohiro
2008-02-27  5:00         ` KAMEZAWA Hiroyuki
2008-02-27  5:04           ` KOSAKI Motohiro
2008-02-27  5:03             ` Balbir Singh
2008-02-27  5:13               ` KOSAKI Motohiro
2008-02-27  5:19               ` David Rientjes
2008-02-27  5:33                 ` KOSAKI Motohiro
2008-02-27  5:47                   ` David Rientjes
2008-02-27  5:48                     ` Balbir Singh
2008-02-27  6:09                       ` David Rientjes
2008-02-27  7:10                         ` KOSAKI Motohiro
2008-02-27  7:19                           ` David Rientjes
2008-02-27  7:51                             ` KAMEZAWA Hiroyuki
2008-02-27  7:56                               ` David Rientjes
2008-02-27  8:09                                 ` KAMEZAWA Hiroyuki
2008-02-27 15:30                             ` Rik van Riel
2008-02-27  7:59                         ` Balbir Singh
2008-02-27  8:47                           ` David Rientjes
2008-02-27  9:01                             ` Balbir Singh
2008-02-27  9:44                               ` Peter Zijlstra
2008-02-27  6:52                       ` KOSAKI Motohiro

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=1204060718.6242.333.camel@lappy \
    --to=a.p.zijlstra@chello.nl \
    --cc=Lee.Schermerhorn@hp.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=riel@redhat.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