linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: alfred@leakybucket.org
To: linux-kernel@vger.kernel.org
Subject: [patch] Re: 2 futex questions
Date: Tue, 24 Sep 2002 18:14:01 -0700	[thread overview]
Message-ID: <20020925011401.GA15543@closet.leakybucket.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0209251015320.4690-100000@localhost.localdomain>

On Wed, Sep 25, 2002 at 10:23:16AM +0200, Ingo Molnar wrote:
> 
> what it says: 'uaddr must be naturally aligned, and the word must be on a
> single page'. In theory it's possible that __alignof__(int) !=
> sizeof(int).
> 

Ok, would the following actually save some cycles then?

diff -u a/kernel/futex.c b/kernel/futex.c 
--- a/kernel/futex.c    Tue Sep 24 15:25:01 2002
+++ b/kernel/futex.c    Tue Sep 24 18:09:09 2002
@@ -321,9 +321,10 @@
 
        pos_in_page = ((unsigned long)uaddr) % PAGE_SIZE;
 
-       /* Must be "naturally" aligned, and not on page boundary. */
+       /* Must be "naturally" aligned, and must not cross a page boundary. */
        if ((pos_in_page % __alignof__(int)) != 0
-           || pos_in_page + sizeof(int) > PAGE_SIZE)
+           || ((sizeof(int) != __alignof__(int))
+                && (pos_in_page + sizeof(int) > PAGE_SIZE)))
                return -EINVAL;
 
        /* Simpler if it doesn't vanish underneath us. */


Alfred Landrum

      reply	other threads:[~2002-09-25  8:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-25  0:33 alfred
2002-09-25  8:23 ` Ingo Molnar
2002-09-25  1:14   ` alfred [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=20020925011401.GA15543@closet.leakybucket.org \
    --to=alfred@leakybucket.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='[patch] Re: 2 futex questions' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).