RE: [PATCH 03/16] IA64: use ACCESS_ONCE for rlimits

From: Luck, Tony
Date: Wed Nov 18 2009 - 13:56:30 EST


> Make sure compiler won't do weird things with limits. E.g. fetching
> them twice may return 2 different values after writable limits are
> implemented.

- if (size > task->signal->rlim[RLIMIT_MEMLOCK].rlim_cur)
+ if (size > ACCESS_ONCE(task->signal->rlim[RLIMIT_MEMLOCK].rlim_cur))

I don't see how this helps. If someone else is changing limits while
we are looking at them, then there is a race. We either get the old
or the new value. Using ACCESS_ONCE (which on ia64 forces a "volatile"
access, which will make the compiler generate "ld.acq" rather than a
plain "ld") won't make any difference to this race.

Please explain what issue you see with the current code.

-Tony

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