Re: [PATCH] Provide an interface to limit total page cache.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Roy Huang" <[email protected]> writes:

> A patch provide a interface to limit total page cache in
> /proc/sys/vm/pagecache_ratio. The default value is 90 percent. Any
> feedback is appreciated.

Anything except a default value of 100% will change the behavior
and probably reduce the performance on most systems.

> -Roy
>
> diff -urp a/include/linux/sysctl.h b/include/linux/sysctl.h
> --- a/include/linux/sysctl.h	2007-01-15 17:18:46.000000000 +0800
> +++ b/include/linux/sysctl.h	2007-01-15 17:03:09.000000000 +0800
> @@ -202,6 +202,7 @@ enum
> 	VM_PANIC_ON_OOM=33,	/* panic at out-of-memory */
> 	VM_VDSO_ENABLED=34,	/* map VDSO into new processes? */
> 	VM_MIN_SLAB=35,		 /* Percent pages ignored by zone reclaim */
> +	VM_PAGECACHE_RATIO=36,  /* Percent memory is used as page cache */
> };
>
>
> diff -urp a/kernel/sysctl.c b/kernel/sysctl.c
> --- a/kernel/sysctl.c	2007-01-15 17:18:46.000000000 +0800
> +++ b/kernel/sysctl.c	2007-01-15 17:03:09.000000000 +0800
> @@ -1035,6 +1035,15 @@ static ctl_table vm_table[] = {
> 		.extra1		= &zero,
> 	},
> #endif
> +	{
> +		.ctl_name	= VM_PAGECACHE_RATIO,
> +		.procname	= "pagecache_ratio",
> +		.data		= &pagecache_ratio,
> +		.maxlen		= sizeof(pagecache_ratio),
> +		.mode		= 0644,
> +		.proc_handler	= &pagecache_ratio_sysctl_handler,
> +		.strategy	= &sysctl_intvec,
> +	},
> 	{ .ctl_name = 0 }
> };

This is broken.

You have allocated a binary number for use with sys_sysctl but
did not test it.

If you need a special proc_handler to take action when the
value is changed you need a special strategy routine.

So since you aren't going to test the binary interface and don't
care about it please don't allocate a number for it and just
use CTL_UNNUMBERED.

And of course please read the top of linux/sysctl.h

Thank you.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux