[ofa-general] Re: EMM: Fixup return value handling of emm_notify()

Andrea Arcangeli
2008-04-02T21:25:15Z

On Wed, Apr 02, 2008 at 12:03:50PM -0700, Christoph Lameter wrote:
> + /*
> + * Callback may return a positive value to indicate a count
> + * or a negative error code. We keep the first error code
> + * but continue to perform callbacks to other subscribed
> + * subsystems.
> + */
> + if (x && result >= 0) {
> + if (x >= 0)
> + result += x;
> + else
> + result = x;
> + }
> }
> +

Now think of when one of the kernel janitors will micro-optimize
PG_dirty to be returned by invalidate_page so a single set_page_dirty
will be invoked... Keep in mind this is a kernel internal APIs, ask
Greg if we can change it in order to optimize later in the future. I
think my #v9 is optimal enough while being simple at the same time,
but anyway it's silly to be hardwired to such an interface that worst
of all requires switch statements instead of proper pointer to
functions and a fixed set of parameters and retval semantics for all
methods.