linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] include/asm-*/bitops.h: fix masking in find_next_zero_bit()
Date: Tue, 24 Jan 2006 00:05:52 +0300	[thread overview]
Message-ID: <20060123210552.GA12531@mipter.zuzino.mipt.ru> (raw)

Commit 3960f2faaf0a67ad352bd5d4085e43f19f33ab91 says:

    [PATCH] m68knommu: fix find_next_zero_bit in bitops.h

    We're starting a number of big applications (memory footprint app.
    1MByte) on our Arcturus uC5272.  Therefore memory fragmentation is a
    real pain for us.  We've switched to uClinux-2.4.27-uc1 and found that
    page_alloc2 fragments the memory heavily.

    Digging into it we found a bug in the find_next_zero_bit function in the
    m68knommu/bitops.h file.  if the size isn't a multiple of 32 than the
    upper bits of the last word to be searched should be masked.  But the
    functions masks the lower bits of the last word because it uses a right
    shift instead of a left shift operator.

Fix same typos.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 include/asm-cris/bitops.h  |    2 +-
 include/asm-frv/bitops.h   |    2 +-
 include/asm-h8300/bitops.h |    2 +-
 include/asm-v850/bitops.h  |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -290,7 +290,7 @@ static inline int find_next_zero_bit (co
 	tmp = *p;
 	
  found_first:
-	tmp |= ~0UL >> size;
+	tmp |= ~0UL << size;
  found_middle:
 	return result + ffz(tmp);
 }
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -209,7 +209,7 @@ static inline int find_next_zero_bit(con
 	tmp = *p;
 
 found_first:
-	tmp |= ~0UL >> size;
+	tmp |= ~0UL << size;
 found_middle:
 	return result + ffz(tmp);
 }
--- a/include/asm-h8300/bitops.h
+++ b/include/asm-h8300/bitops.h
@@ -227,7 +227,7 @@ static __inline__ int find_next_zero_bit
 	tmp = *p;
 
 found_first:
-	tmp |= ~0UL >> size;
+	tmp |= ~0UL << size;
 found_middle:
 	return result + ffz(tmp);
 }
--- a/include/asm-v850/bitops.h
+++ b/include/asm-v850/bitops.h
@@ -188,7 +188,7 @@ static inline int find_next_zero_bit(con
 	tmp = *p;
 
  found_first:
-	tmp |= ~0UL >> size;
+	tmp |= ~0UL << size;
  found_middle:
 	return result + ffz (tmp);
 }


                 reply	other threads:[~2006-01-23 20:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060123210552.GA12531@mipter.zuzino.mipt.ru \
    --to=adobriyan@gmail.com \
    --cc=akpm@osdl.org \
    --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;
as well as URLs for NNTP newsgroup(s).