From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@linux.intel.com>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH mmotm] radix-tree: rewrite radix_tree_locate_item fix
Date: Sun, 1 May 2016 21:13:18 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.11.1605012108490.1166@eggly.anvils> (raw)
radix_tree_locate_item() is often returning the wrong index, causing
swapoff of shmem to hang because it cannot find the swap entry there.
__locate()'s use of base is bogus, it adds an offset twice into index.
Signed-off-by: Hugh Dickins <hughd@google.com>
---
Fix to radix-tree-rewrite-radix_tree_locate_item.patch
lib/radix-tree.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- 4.6-rc5-mm1/lib/radix-tree.c 2016-04-30 22:55:06.067184898 -0700
+++ linux/lib/radix-tree.c 2016-05-01 18:52:06.668085420 -0700
@@ -1254,15 +1254,14 @@ struct locate_info {
static unsigned long __locate(struct radix_tree_node *slot, void *item,
unsigned long index, struct locate_info *info)
{
- unsigned long base, i;
+ unsigned long i;
do {
unsigned int shift = slot->shift;
- base = index & ~((1UL << shift) - 1);
for (i = (index >> shift) & RADIX_TREE_MAP_MASK;
i < RADIX_TREE_MAP_SIZE;
- i++, index = base + (i << shift)) {
+ i++, index += (1UL << shift)) {
struct radix_tree_node *node =
rcu_dereference_raw(slot->slots[i]);
if (node == RADIX_TREE_RETRY)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2016-05-02 4:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 4:13 Hugh Dickins [this message]
2016-05-03 20:27 ` [PATCH] radix-tree: add test for radix_tree_locate_item() Ross Zwisler
2016-05-03 20:28 ` [PATCH mmotm] radix-tree: rewrite radix_tree_locate_item fix Ross Zwisler
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=alpine.LSU.2.11.1605012108490.1166@eggly.anvils \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ross.zwisler@linux.intel.com \
--cc=willy@linux.intel.com \
/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