public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Janet Morgan <janetmor@us.ibm.com>
Subject: Re: [patch] epoll for 2.4.20 updated ...
Date: Sat, 25 Jan 2003 22:58:44 +0100	[thread overview]
Message-ID: <20030125215844.GA3750@werewolf.able.es> (raw)
In-Reply-To: <Pine.LNX.4.50.0301242004010.2858-100000@blue1.dev.mcafeelabs.com>; from davidel@xmailserver.org on Sat, Jan 25, 2003 at 05:06:30 +0100


On 2003.01.25 Davide Libenzi wrote:
> 
> I updated the 2.4.20 patch with the changes posted today and I fixed a
> little error about the wait queue function prototype :
> 
> http://www.xmailserver.org/linux-patches/sys_epoll-2.4.20-0.61.diff
> 

Mixing epoll ontop of current aa, I found this:

#define add_wait_queue_cond(q, wait, cond) \
    ({                          \
        unsigned long flags;                \
        int _raced = 0;                 \
        wq_write_lock_irqsave(&(q)->lock, flags);   \
        (wait)->flags = 0;              \
        __add_wait_queue((q), (wait));          \
        mb();                       \
        if (!(cond)) {                  \
            _raced = 1;             \
            __remove_wait_queue((q), (wait));   \
        }                       \
        wq_write_unlock_irqrestore(&(q)->lock, flags);  \
        _raced;                     \
    })

this is the -aa version. Version from epoll uses just a rmb() barrier
(afaik, just a _read_ barrier). In -aa they are just the same, but I also
use a patch that does this:


+#ifdef CONFIG_X86_MFENCE
+#define mb()   __asm__ __volatile__ ("mfence": : :"memory")
+#else
 #define mb()   __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
+#endif
+
+#ifdef CONFIG_X86_LFENCE
+#define rmb()  __asm__ __volatile__ ("lfence": : :"memory")
+#else
 #define rmb()  mb()
+#endif

so for modern processors they are different, and can affect performance and
correctness. So  which one it the correct one for the above code snipet ?

TIA

-- 
J.A. Magallon <jamagallon@able.es>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.1 (Cooker) for i586
Linux 2.4.21-pre3-jam3 (gcc 3.2.1 (Mandrake Linux 9.1 3.2.1-3mdk))

  reply	other threads:[~2003-01-25 21:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-25  4:06 [patch] epoll for 2.4.20 updated Davide Libenzi
2003-01-25 21:58 ` J.A. Magallon [this message]
2003-01-25 23:44   ` Davide Libenzi
2003-01-26  0:15 ` J.A. Magallon
2003-01-26  0:28   ` Davide Libenzi

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=20030125215844.GA3750@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=davidel@xmailserver.org \
    --cc=janetmor@us.ibm.com \
    --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