From: Manfred Spraul <manfred@colorfullife.com>
To: Nadia Derbey <Nadia.Derbey@bull.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] ipc/sem.c: convert sem_array.sem_pending to struct list_head
Date: Sat, 07 Jun 2008 16:52:53 +0200 [thread overview]
Message-ID: <484AA0C5.9040108@colorfullife.com> (raw)
In-Reply-To: <483EC693.7030808@bull.net>
Nadia Derbey wrote:
> Manfred Spraul wrote:
>> sem_array.sem_pending is a double linked list, the attached
>> patch converts it to struct list_head.
>>
>> Signed-Off-By: Manfred Spraul <manfred@colorfullife.com>
>
> Reviewed-By: Nadia Derbey <Nadia.Derbey@bull.net>
>
>>
>> @@ -438,16 +405,15 @@ static void update_queue (struct sem_array * sma)
>> int error;
>> struct sem_queue * q;
>>
>> - q = sma->sem_pending;
>> - while(q) {
>> + q = list_entry(sma->sem_pending.next, struct sem_queue, list);
>> + while(&q->list != &sma->sem_pending) {
>
> I guess here you are not using list_first_entry() because the pending
> requests might be empty?
>
Actually - no. I wasn't aware of list_first_entry().
But:
- Looking at list.h: list_first_entry() shouldn't be used on empty lists.
- the loop in update_queue() is complicated enough, some open-coding
doesn't hurt.
>> @@ -1194,7 +1171,6 @@ asmlinkage long sys_semtimedop(int semid,
>> struct sembuf __user *tsops,
>>
>> sma = sem_lock(ns, semid);
>> if (IS_ERR(sma)) {
>> - BUG_ON(queue.prev != NULL);
>
> Instead of removing it why not replacing the bug_ON() by a check on
> the queue still being linked?
>
The list_del() poisoning is IMHO efficient enough.
--
Manfred
prev parent reply other threads:[~2008-06-07 14:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-24 11:26 [PATCH 3/4] ipc/sem.c: convert sem_array.sem_pending to struct list_head Manfred Spraul
2008-05-29 15:06 ` Nadia Derbey
2008-06-07 14:52 ` Manfred Spraul [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=484AA0C5.9040108@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=Nadia.Derbey@bull.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox