Re: [PATCH 1/5] ipc/sem: do not call wake_sem_queue_do() prematurely

From: Davidlohr Bueso
Date: Tue Sep 13 2016 - 04:14:52 EST


On Tue, 13 Sep 2016, Manfred Spraul wrote:

- if (ipcperms(ns, &sma->sem_perm, alter ? S_IWUGO : S_IRUGO))
- goto out_rcu_wakeup;
+ if (ipcperms(ns, &sma->sem_perm, alter ? S_IWUGO : S_IRUGO)) {
+ rcu_read_unlock();
+ goto out_free;
+ }
Is this really better/simpler?
You replace "if (error) goto cleanup" with "if (error) {cleanup_1(); goto cleanup_2()}".

I believe it is better as it clearly separates blocking from non-blocking
exit paths. Overhead of course is irrelevant in both in-house wake_up_sem_queue_do
and wake_up_q.

Thanks,
Davidlohr