Re: Patch: linux-2.5.29 __downgrade_write() for CONFIG_RWSEM_GENERIC_SPINLOCK

David Howells (dhowells@redhat.com)
Mon, 29 Jul 2002 13:08:22 +0100


Roman Zippel <zippel@linux-m68k.org>
> > It doesn't appear to make any difference which way it is done. The i386
> > code from both looks the same.
>
> Then I vote for the simpler version. :)

Maybe... I've got a patch for that variation too.

> BTW even if gcc had problems optimizing that, I'd rather make it explicit,
> that the two variables contain the same information:
>
> activity = sem->activity = 0;
> if (!list_empty(&sem->wait_list))
> sem = __rwsem_do_wake(sem, activity);
>
> IMO that's more readable and will still work if gcc had to flush the
> cached information before using it.

Brrr... I don't like that. If I'm going to pass in a second argument, then I
want it to be what Christoph's version because it's more readable and more
obvious what it's doing (and, since the value is constant, the optimiser can
obviously get rid of it easily). I don't think gcc is going to be a problem in
that respect since the activity member is not volatile.

David
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/