lkml.org 
[lkml]   [2008]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 2/2] mm: add dirty_background_bytes and dirty_bytes sysctls
On Sun, 23 Nov 2008 10:55:16 -0800 (PST)
David Rientjes <rientjes@google.com> wrote:

> This change introduces two new sysctls to /proc/sys/vm:
> dirty_background_bytes and dirty_bytes.
>
>
> ...
>
> @@ -365,23 +429,29 @@ void
> get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
> unsigned long *pbdi_dirty, struct backing_dev_info *bdi)
> {
> - int background_ratio; /* Percentages */
> - int dirty_ratio;
> unsigned long background;
> unsigned long dirty;
> unsigned long available_memory = determine_dirtyable_memory();
> struct task_struct *tsk;
>
> - dirty_ratio = vm_dirty_ratio;
> - if (dirty_ratio < 5)
> - dirty_ratio = 5;
> + if (vm_dirty_bytes)
> + dirty = (vm_dirty_bytes + PAGE_SIZE) / PAGE_SIZE;

It would be conventional to use DIV_ROUND_UP() here.

> + else {
> + int dirty_ratio;

hm, I wonder why vm_dirty_ratio has a signed type.

> - background_ratio = dirty_background_ratio;
> - if (background_ratio >= dirty_ratio)
> - background_ratio = dirty_ratio / 2;
> + dirty_ratio = vm_dirty_ratio;
> + if (dirty_ratio < 5)
> + dirty_ratio = 5;
> + dirty = (dirty_ratio * available_memory) / 100;
> + }
> +
> + if (dirty_background_bytes)
> + background = (dirty_background_bytes + PAGE_SIZE) / PAGE_SIZE;

DIV_ROUND_UP()?

> + else
> + background = (dirty_background_ratio * available_memory) / 100;
>
> - background = (background_ratio * available_memory) / 100;
> - dirty = (dirty_ratio * available_memory) / 100;
> + if (background >= dirty)
> + background = dirty / 2;
> tsk = current;
> if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk)) {
> background += background / 4;


\
 
 \ /
  Last update: 2008-11-25 00:41    [from the cache]
©2003-2011 Jasper Spaans