[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1240994676.8021.83.camel@laptop>
Date: Wed, 29 Apr 2009 10:44:36 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Andrea Righi <righi.andrea@...il.com>
Cc: David Rientjes <rientjes@...gle.com>, akpm@...ux-foundation.org,
Dave Chinner <david@...morbit.com>,
Christoph Lameter <cl@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: prevent divide error for small values of
vm_dirty_bytes
On Wed, 2009-04-29 at 10:29 +0200, Andrea Righi wrote:
> Avoid to set less than two pages for vm_dirty_byte: this is necessary to avoid
> potential division by 0 (like the following) in get_dirty_limits().
isn't changing the .extra1 in the sysctl table a better fix?
> Signed-off-by: Andrea Righi <righi.andrea@...il.com>
> ---
> mm/page-writeback.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 30351f0..9d6c427 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -213,6 +213,12 @@ int dirty_bytes_handler(struct ctl_table *table, int write,
> int ret;
>
> ret = proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos);
> + /*
> + * Do not allow to set less than two pages for vm_dirty_byte: this is
> + * necessary to avoid division by 0 in get_dirty_limits().
> + */
> + vm_dirty_bytes = max_t(typeof(vm_dirty_bytes),
> + vm_dirty_bytes, 2 * PAGE_SIZE);
> if (ret == 0 && write && vm_dirty_bytes != old_bytes) {
> update_completion_period();
> vm_dirty_ratio = 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists