Re: [PATCH] sysctl: Fix division by zero in percpu_pagelist_fraction handler

From: Oleg Drokin
Date: Tue Jun 03 2014 - 00:17:43 EST


Hello!

On Jun 2, 2014, at 11:57 PM, David Rientjes wrote:
> I'm pretty sure we want to allow users to restore the kernel default
> behavior if they've already written to this file and now want to change it
> back.
>
> What do you think about doing it like this instead?
> ---
> Documentation/sysctl/vm.txt | 3 ++-
> kernel/sysctl.c | 3 +--
> mm/page_alloc.c | 20 ++++++++++++--------
> 3 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
> --- a/Documentation/sysctl/vm.txt
> +++ b/Documentation/sysctl/vm.txt
> @@ -702,7 +702,8 @@ The batch value of each per cpu pagelist is also updated as a result. It is
> set to pcp->high/4. The upper limit of batch is (PAGE_SHIFT * 8)
>
> The initial value is zero. Kernel does not use this value at boot time to set
> -the high water marks for each per cpu page list.
> +the high water marks for each per cpu page list. If the user writes '0' to this
> +sysctl, it will revert to this default behavior.

I think this is probably a better idea indeed.
Always good to let users return back to defaults too.

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/