public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: randy_dunlap <rdunlap@xenotime.net>
Cc: Patrick Plattes <patrick@erdbeere.net>, linux-kernel@vger.kernel.org
Subject: Re: semaphore understanding: sys_semtimedop()
Date: Sun, 22 May 2005 08:49:48 +0200	[thread overview]
Message-ID: <42902B8C.1070401@colorfullife.com> (raw)
In-Reply-To: <20050521222151.15bb0eb4.rdunlap@xenotime.net>

randy_dunlap wrote:

>On Mon, 16 May 2005 22:17:04 +0200 Patrick Plattes wrote:
>
>| The variable decrease will never be used again in this 
>| function, so why this intricate code? Isn't this much easier and works
>| also:
>| 
>|         for (sop = sops; sop < sops + nsops; sop++) {
>|                 if (sop->sem_num >= max)
>|                         max = sop->sem_num;
>|                 if (sop->sem_flg & SEM_UNDO)
>|                         undos++;
>|                 if (sop->sem_op != 0)
>|                         alter = 1;
>|         }
>| 
>| Maybe i'm totally wrong, so please correct me and don't shoot me up,
>| 'cause i'm not a os developer.
>
>Looks like a reasonable and correct optimization to me.
>
>  
>
It looks correct:
decrease was added during 2.1 development: it's not in 2.0.40, it's in 
2.2.26: I think the idea was that operations with decrease can cause 
other threads to block, therefore a different wakeup strategy was used. 
The wakeup implementation was rewritten, but the loop remained unchanged.
I'll write a patch, thanks Patrick.

--
    Manfred

      reply	other threads:[~2005-05-22  6:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-16 20:17 semaphore understanding: sys_semtimedop() Patrick Plattes
2005-05-22  5:21 ` randy_dunlap
2005-05-22  6:49   ` 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=42902B8C.1070401@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrick@erdbeere.net \
    --cc=rdunlap@xenotime.net \
    /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