From: majianpeng <majianpeng@gmail.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-mm <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] mm/kmemleak.c: Use list_for_each_entry_safe to reconstruct function scan_gray_list
Date: Tue, 14 May 2013 19:49:44 +0800 [thread overview]
Message-ID: <519224D8.5090704@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
mm/kmemleak.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index b1525db..f0ece93 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1225,22 +1225,16 @@ static void scan_gray_list(void)
* from inside the loop. The kmemleak objects cannot be freed from
* outside the loop because their use_count was incremented.
*/
- object = list_entry(gray_list.next, typeof(*object), gray_list);
- while (&object->gray_list != &gray_list) {
+ list_for_each_entry_safe(object, tmp, &gray_list, gray_list) {
cond_resched();
/* may add new objects to the list */
if (!scan_should_stop())
scan_object(object);
- tmp = list_entry(object->gray_list.next, typeof(*object),
- gray_list);
-
/* remove the object from the list and release it */
list_del(&object->gray_list);
put_object(object);
-
- object = tmp;
}
WARN_ON(!list_empty(&gray_list));
}
--
1.8.3.rc1.44.gb387c77
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-mm-kmemleak.c-Use-list_for_each_entry_safe-to-recons.patch --]
[-- Type: text/x-patch; name="0002-mm-kmemleak.c-Use-list_for_each_entry_safe-to-recons.patch", Size: 0 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: majianpeng <majianpeng@gmail.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-mm <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] mm/kmemleak.c: Use list_for_each_entry_safe to reconstruct function scan_gray_list
Date: Tue, 14 May 2013 19:49:44 +0800 [thread overview]
Message-ID: <519224D8.5090704@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
mm/kmemleak.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index b1525db..f0ece93 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1225,22 +1225,16 @@ static void scan_gray_list(void)
* from inside the loop. The kmemleak objects cannot be freed from
* outside the loop because their use_count was incremented.
*/
- object = list_entry(gray_list.next, typeof(*object), gray_list);
- while (&object->gray_list != &gray_list) {
+ list_for_each_entry_safe(object, tmp, &gray_list, gray_list) {
cond_resched();
/* may add new objects to the list */
if (!scan_should_stop())
scan_object(object);
- tmp = list_entry(object->gray_list.next, typeof(*object),
- gray_list);
-
/* remove the object from the list and release it */
list_del(&object->gray_list);
put_object(object);
-
- object = tmp;
}
WARN_ON(!list_empty(&gray_list));
}
--
1.8.3.rc1.44.gb387c77
[-- Attachment #2: 0002-mm-kmemleak.c-Use-list_for_each_entry_safe-to-recons.patch --]
[-- Type: text/x-patch, Size: 1273 bytes --]
>From 095c9fc03bacb14a896cc9b56c7e2e3843c6051b Mon Sep 17 00:00:00 2001
From: Jianpeng Ma <majianpeng@gmail.com>
Date: Tue, 14 May 2013 15:36:14 +0800
Subject: [PATCH 2/3] mm/kmemleak.c: Use list_for_each_entry_safe to
reconstruct function scan_gray_list.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
mm/kmemleak.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index b1525db..f0ece93 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1225,22 +1225,16 @@ static void scan_gray_list(void)
* from inside the loop. The kmemleak objects cannot be freed from
* outside the loop because their use_count was incremented.
*/
- object = list_entry(gray_list.next, typeof(*object), gray_list);
- while (&object->gray_list != &gray_list) {
+ list_for_each_entry_safe(object, tmp, &gray_list, gray_list) {
cond_resched();
/* may add new objects to the list */
if (!scan_should_stop())
scan_object(object);
- tmp = list_entry(object->gray_list.next, typeof(*object),
- gray_list);
-
/* remove the object from the list and release it */
list_del(&object->gray_list);
put_object(object);
-
- object = tmp;
}
WARN_ON(!list_empty(&gray_list));
}
--
1.8.3.rc1.44.gb387c77
next reply other threads:[~2013-05-14 11:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-14 11:49 majianpeng [this message]
2013-05-14 11:49 ` [PATCH 2/3] mm/kmemleak.c: Use list_for_each_entry_safe to reconstruct function scan_gray_list majianpeng
2013-05-30 14:40 ` Catalin Marinas
2013-05-30 14:40 ` Catalin Marinas
2013-06-03 0:58 ` majianpeng
2013-06-03 0:58 ` majianpeng
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=519224D8.5090704@gmail.com \
--to=majianpeng@gmail.com \
--cc=catalin.marinas@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.