Re: [for-next][PATCH 1/4] ring-buffer: Replace this_cpu_*() with __this_cpu_*()

From: Christoph Lameter
Date: Mon Mar 30 2015 - 08:44:37 EST


On Fri, 27 Mar 2015, Steven Rostedt wrote:

> Where in the patch do you see the comment? Or were you talking about
> the change log? The original patch did have a comment, an it was
> dropped, that's what I thought you were talking about.

Sorry yes the changelog.

> Actually, it is equivalent, but I do see a issue with my patch.
>
> val &= val & (val - 1);
>
> is the same as the more reasonable:
>
> val &= val - 1;
>
> I think I meant to replace &= with = :-/
>
> >
> > or more compact
> >
> > unsigned int val = __this_cpu_read(current_context);
> >
> > __this_cpu_write(current_context, val & (val - 1));
>
> Maybe I'll just use your compact version.

Hmmm... It could even be more compact

__this_cpu_and(current_context, __this_cpu_read(current_context) - 1);

--
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/