Re: [PATCH -mm] vmscan: make mapped executable pages the first class citizen

Wu Fengguang
2009-05-10T09:21:50Z

On Sun, May 10, 2009 at 04:59:17PM +0800, KOSAKI Motohiro wrote:
> 2009/5/9 Alan Cox <alan@lxorguk.ukuu.org.uk>:
> >> The patch seems reasonable but the changelog and the (non-existent)
> >> design documentation could do with a touch-up.
> >
> > Is it right that I as a user can do things like mmap my database
> > PROT_EXEC to get better database numbers by making other
> > stuff swap first ?
> >
> > You seem to be giving everyone a "nice my process up" hack.
>
> How about this?

Why it deserves more tricks? PROT_EXEC pages are rare.
If user space is to abuse PROT_EXEC, let them be for it ;-)

> if priority < DEF_PRIORITY-2, aggressive lumpy reclaim in
> shrink_inactive_list() already
> reclaim the active page forcely.

Isn't lumpy reclaim now enabled by (and only by) non-zero order?

> then, this patch don't change kernel reclaim policy.
>
> anyway, user process non-changable preventing "nice my process up
> hack" seems makes sense to me.
>
> test result:
>
> echo 100 > /proc/sys/vm/dirty_ratio
> echo 100 > /proc/sys/vm/dirty_background_ratio
> run modified qsbench (use mmap(PROT_EXEC) instead malloc)
>
> active2active vs active2inactive ratio
> before 5:5
> after 1:9

Do you have scripts for producing such numbers? I'm dreaming to have
such tools :-)

> please don't ask performance number. I haven't reproduce Wu's patch
> improvemnt ;)

That's why I decided to "explain" instead of "benchmark" the benefits
of my patch, hehe.

Thanks,
Fengguang

> ---
> mm/vmscan.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Index: b/mm/vmscan.c
> ===================================================================
> --- a/mm/vmscan.c 2009-05-10 02:40:01.000000000 +0900
> +++ b/mm/vmscan.c 2009-05-10 03:33:30.000000000 +0900
> @@ -1275,7 +1275,8 @@ static void shrink_active_list(unsigned
> struct address_space *mapping = page_mapping(page);
>
> pgmoved++;
> - if (mapping && test_bit(AS_EXEC, &mapping->flags)) {
> + if (mapping && (priority >= DEF_PRIORITY - 2) &&
> + test_bit(AS_EXEC, &mapping->flags)) {
> pga2a++;
> list_add(&page->lru, &l_active);
> continue;