Re: [PATCH v2 02/07] cpuset use combined atomic_inc_return calls

From: Paul Jackson
Date: Thu Feb 09 2006 - 16:06:24 EST


Michael wrote:
> Is this hunk really correct? I did not look into the code, but from
> the patch context it seems like it adds an inc here.

You have sharp eyes.

It doesn't matter much either way whether we increment or not here.

That's because this is in cpuset_init_early(), which is the -very- first
use of the global cpuset_mems_generation counter. All other uses must
increment, so that they don't reuse a generation value someone else
used. But we're first, so no possibility of reuse.

We can start with the first value, zero (0), or we can increment and
use one (1).

I changed it to atomic_inc_return() just to be consistent with all the
other locations that read this. That way, if anyone else ever has to
get a value of cpuset_mems_generation and looks around to see how to do
it, they will see that it is always done using atomic_inc_return(), and
probably do it the same way, with minimum risk of confusion.

Just avoiding gratuitous differences in code that don't have a good
reason.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.925.600.0401
-
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/