On Tue, 09 Apr 2013 11:39:07 +0200 Nikola Pajkovsky <npajk...@redhat.com> wrote:
> Andrew Morton <a...@linux-foundation.org> writes: > > > urgh, that code is sick. What's it doing poking around in the > > list_head internals? > > No idea, it there from beginning of first kernel importation into > git. Where is history before git? The old bitkeeper repo is at git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/old-2.6-bkcvs.git and goes back to the 2.4->2.5 split iirc. But this code predates that - my trusty CVS tree goes back to linux-2.4.2-pre2 (November 2000) and the list.next hackery is in there. > >> @@ -253,14 +248,9 @@ static void ss_wakeup(struct list_head *h, int kill) > >> > >> static void expunge_all(struct msg_queue *msq, int res) > >> { > >> - struct list_head *tmp; > >> - > >> - tmp = msq->q_receivers.next; > >> - while (tmp != &msq->q_receivers) { > >> - struct msg_receiver *msr; > >> + struct msg_receiver *msr, *t; > >> > >> - msr = list_entry(tmp, struct msg_receiver, r_list); > >> - tmp = tmp->next; > >> + list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) { > >> msr->r_msg = NULL; > >> wake_up_process(msr->r_tsk); > >> smp_mb(); > > > > I think list_for_each_entry() would suffice here. > > I don't know, I found wake_up_sem_queue_do in sem.c and it looks almost same > except preempt stuff. I'll be dancing around ipc/ wake_up_sem_queue_do() is wrong ;) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/