Re: [PATCH] use local_t for page statistics

Marcelo Tosatti
2006-01-08T01:49:22Z

On Fri, Jan 06, 2006 at 04:33:13PM -0800, Andrew Morton wrote:
> Benjamin LaHaise <bcrl@kvack.org> wrote:
> >
> > The patch below converts the mm page_states counters to use local_t.
> > mod_page_state shows up in a few profiles on x86 and x86-64 due to the
> > disable/enable interrupts operations touching the flags register. On
> > both my laptop (Pentium M) and P4 test box this results in about 10
> > additional /bin/bash -c exit 0 executions per second (P4 went from ~759/s
> > to ~771/s). Tested on x86 and x86-64. Oh, also add a pgcow statistic
> > for the number of COW page faults.
>
> Bah. I think this is a better approach than the just-merged
> mm-page_state-opt.patch, so I should revert that patch first?

Don't think so - local_t operations are performed atomically, which is
not required for most hotpath page statistics operations since proper
locks are already held.

What is wanted for these cases are simple inc/dec (non-atomic)
instructions, which is what Nick's patch does by introducing
__mod_page_state.

Ben, have you tested mm-page_state-opt.patch? It should get rid of
most "flags" save/restore on stack.