From: zhouzhouyi@gmail.com
To: aryabinin@virtuozzo.com, glider@google.com, dvyukov@google.com,
kasan-dev@googlegroups.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Cc: Zhouyi Zhou <zhouzhouyi@gmail.com>
Subject: [PATCH 1/1] kasan: fix livelock in qlist_move_cache
Date: Tue, 28 Nov 2017 04:04:02 +0000 [thread overview]
Message-ID: <1511841842-3786-1-git-send-email-zhouzhouyi@gmail.com> (raw)
From: Zhouyi Zhou <zhouzhouyi@gmail.com>
This patch fix livelock by conditionally release cpu to let others
has a chance to run.
Tested on x86_64.
Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
---
mm/kasan/quarantine.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c
index 3a8ddf8..33eeff4 100644
--- a/mm/kasan/quarantine.c
+++ b/mm/kasan/quarantine.c
@@ -265,10 +265,13 @@ static void qlist_move_cache(struct qlist_head *from,
struct kmem_cache *cache)
{
struct qlist_node *curr;
+ struct qlist_head tmp_head;
+ unsigned long flags;
if (unlikely(qlist_empty(from)))
return;
+ qlist_init(&tmp_head);
curr = from->head;
qlist_init(from);
while (curr) {
@@ -278,10 +281,17 @@ static void qlist_move_cache(struct qlist_head *from,
if (obj_cache == cache)
qlist_put(to, curr, obj_cache->size);
else
- qlist_put(from, curr, obj_cache->size);
+ qlist_put(&tmp_head, curr, obj_cache->size);
curr = next;
+
+ if (need_resched()) {
+ spin_unlock_irqrestore(&quarantine_lock, flags);
+ cond_resched();
+ spin_lock_irqsave(&quarantine_lock, flags);
+ }
}
+ qlist_move_all(&tmp_head, from);
}
static void per_cpu_remove_cache(void *arg)
--
2.1.4
--
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:[~2017-11-28 4:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 4:04 zhouzhouyi [this message]
2017-11-28 4:05 ` [PATCH 1/1] kasan: fix livelock in qlist_move_cache Zhouyi Zhou
2017-11-28 7:45 ` Dmitry Vyukov
2017-11-28 8:00 ` Zhouyi Zhou
2017-11-28 8:12 ` Dmitry Vyukov
2017-11-28 8:33 ` Zhouyi Zhou
2017-11-28 8:58 ` Dmitry Vyukov
2017-11-28 9:17 ` Zhouyi Zhou
2017-11-28 9:27 ` Dmitry Vyukov
2017-11-28 11:30 ` Zhouyi Zhou
2017-11-28 17:56 ` Dmitry Vyukov
2017-11-28 17:57 ` Dmitry Vyukov
2017-11-28 23:02 ` Zhouyi Zhou
2017-11-28 23:41 ` Zhouyi Zhou
2017-11-29 4:54 ` Zhouyi Zhou
2017-11-29 9:03 ` Dmitry Vyukov
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=1511841842-3786-1-git-send-email-zhouzhouyi@gmail.com \
--to=zhouzhouyi@gmail.com \
--cc=aryabinin@virtuozzo.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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).