linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: righi.andrea@gmail.com
Cc: balbir@linux.vnet.ibm.com, Michael Rubin <mrubin@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	menage@google.com, dave@linux.vnet.ibm.com, chlunde@ping.uio.no,
	dpshah@google.com, eric.rannaud@gmail.com,
	fernando@oss.ntt.co.jp, agk@sourceware.org,
	m.innocenti@cineca.it, s-uchida@ap.jp.nec.com,
	ryov@valinux.co.jp, matt@bluehost.com, dradford@bluehost.com,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -mm] page-writeback: fine-grained dirty_ratio and dirty_background_ratio
Date: Fri, 10 Oct 2008 09:41:39 +0900	[thread overview]
Message-ID: <20081010094139.e7f8653d.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <48EE236A.90007@gmail.com>

On Thu, 09 Oct 2008 17:29:46 +0200
Andrea Righi <righi.andrea@gmail.com> wrote:

> The current granularity of 5% of dirtyable memory for dirty pages writeback is
> too coarse for large memory machines and this will get worse as
> memory-size/disk-speed ratio continues to increase.
> 
> These large writebacks can be unpleasant for desktop or latency-sensitive
> environments, where the time to complete a writeback can be perceived as a
> lack of responsiveness by the whole system.
> 
> So, something to define fine grained settings is needed.
> 
> Following there's a similar solution as discussed in [1], but I tried to
> simplify the things a little bit, in order to provide the same functionality
> (in particular try to avoid backward compatibility problems) and reduce the
> amount of code needed to implement an in-kernel parser to handle percentages
> with decimals digits.
> 
> The kernel provides the following parameters:
>  - dirty_ratio, dirty_background_ratio in percentage
>    (1 ... 100)
>  - dirty_ratio_pcm, dirty_background_ratio_pcm in units of percent mille
>    (1 ... 100,000)
> 
> Both dirty_ratio and dirty_ratio_pcm refer to the same vm_dirty_ratio variable,
> only the interface to read/write this value is different. The same is valid for
> dirty_background_ratio and dirty_background_ratio_pcm.
> 
> In this way it's possible to provide a fine grained interface to configure the
> writeback policy and at the same time preserve the compatibility with the old
> coarse grained dirty_ratio / dirty_background_ratio users.
> 
> Examples:
>  # echo 5 > /proc/sys/vm/dirty_ratio
>  # cat /proc/sys/vm/dirty_ratio
>  5
>  # cat /proc/sys/vm/dirty_ratio_pcm
>  5000
> 
>  # echo 500 > /proc/sys/vm/dirty_ratio_pcm
>  # cat /proc/sys/vm/dirty_ratio
>  0
>  # cat /proc/sys/vm/dirty_ratio_pcm
>  500
> 
>  # echo 5500 > /proc/sys/vm/dirty_ratio_pcm
>  # cat /proc/sys/vm/dirty_ratio
>  5
>  # cat /proc/sys/vm/dirty_ratio_pcm
>  5500
> 
I like this. thanks.

<snip>

> -int dirty_background_ratio = 5;
> +int dirty_background_ratio = 5 * PERCENT_PCM;
>  
>  /*
>   * free highmem will not be subtracted from the total free memory
> @@ -77,7 +77,7 @@ int vm_highmem_is_dirtyable;
>  /*
>   * The generator of dirty data starts writeback at this percentage
>   */
> -int vm_dirty_ratio = 10;
> +int vm_dirty_ratio = 10 * PERCENT_PCM;
>  
>  /*
>   * The interval between `kupdate'-style writebacks, in jiffies
> @@ -135,7 +135,8 @@ static int calc_period_shift(void)
>  {
>  	unsigned long dirty_total;
>  
> -	dirty_total = (vm_dirty_ratio * determine_dirtyable_memory()) / 100;
> +	dirty_total = (vm_dirty_ratio * determine_dirtyable_memory())
> +			/ ONE_HUNDRED_PCM;
>  	return 2 + ilog2(dirty_total - 1);
>  }
>  
I wonder...isn't this overflow in 32bit system ?

Thanks,
-Kame


--
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-10-10  0:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1221232192-13553-1-git-send-email-righi.andrea@gmail.com>
     [not found] ` <20080912131816.e0cfac7a.akpm@linux-foundation.org>
     [not found]   ` <532480950809221641y3471267esff82a14be8056586@mail.gmail.com>
     [not found]     ` <48EB4236.1060100@linux.vnet.ibm.com>
     [not found]       ` <48EB851D.2030300@gmail.com>
     [not found]         ` <20081008101642.fcfb9186.kamezawa.hiroyu@jp.fujitsu.com>
     [not found]           ` <48ECB215.4040409@linux.vnet.ibm.com>
2008-10-09 15:29             ` Andrea Righi
2008-10-10  0:41               ` KAMEZAWA Hiroyuki [this message]
2008-10-10  9:32                 ` Andrea Righi
2008-10-10 13:13                   ` Andrea Righi
2008-11-10 20:58               ` [PATCH -mm] mm: fine-grained dirty_ratio_pcm and dirty_background_ratio_pcm (v2) Andrea Righi
2008-11-10 21:12                 ` Andrew Morton
2008-11-10 22:03                   ` Andrea Righi
2008-11-10 22:12                     ` Andrew Morton
2008-11-10 22:15                     ` David Rientjes

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=20081010094139.e7f8653d.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=agk@sourceware.org \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=chlunde@ping.uio.no \
    --cc=dave@linux.vnet.ibm.com \
    --cc=dpshah@google.com \
    --cc=dradford@bluehost.com \
    --cc=eric.rannaud@gmail.com \
    --cc=fernando@oss.ntt.co.jp \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=m.innocenti@cineca.it \
    --cc=matt@bluehost.com \
    --cc=menage@google.com \
    --cc=mrubin@google.com \
    --cc=righi.andrea@gmail.com \
    --cc=ryov@valinux.co.jp \
    --cc=s-uchida@ap.jp.nec.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