From: Johannes Weiner <hannes@cmpxchg.org>
To: Bob Liu <lliubbo@gmail.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org, mpm@selenic.com
Subject: Re: [PATCH] slob:Use _safe funtion to iterate partially free list.
Date: Sun, 4 Jul 2010 12:16:40 +0200 [thread overview]
Message-ID: <20100704101640.GA1634@cmpxchg.org> (raw)
In-Reply-To: <1278235353-9638-1-git-send-email-lliubbo@gmail.com>
On Sun, Jul 04, 2010 at 05:22:33PM +0800, Bob Liu wrote:
> Since a list entry may be removed, so use list_for_each_entry_safe
> instead of list_for_each_entry.
>
> Signed-off-by: Bob Liu <lliubbo@gmail.com>
> ---
> mm/slob.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/slob.c b/mm/slob.c
> index 3f19a34..e2af18b 100644
> --- a/mm/slob.c
> +++ b/mm/slob.c
> @@ -320,7 +320,7 @@ static void *slob_page_alloc(struct slob_page *sp, size_t size, int align)
> */
> static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
> {
> - struct slob_page *sp;
> + struct slob_page *sp, *tmp;
> struct list_head *prev;
> struct list_head *slob_list;
> slob_t *b = NULL;
> @@ -335,7 +335,7 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
>
> spin_lock_irqsave(&slob_lock, flags);
> /* Iterate through each partially free page, try to find room */
> - list_for_each_entry(sp, slob_list, list) {
> + list_for_each_entry_safe(sp, tmp, slob_list, list) {
> #ifdef CONFIG_NUMA
sp's list head is only modified if an allocation was successful, but
then the iteration stops as well. So I see no reason for your patch.
Did I overlook something?
Hannes
--
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 prev parent reply other threads:[~2010-07-04 10:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-04 9:22 Bob Liu
2010-07-04 10:16 ` Johannes Weiner [this message]
2010-07-05 12:50 ` Bob Liu
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=20100704101640.GA1634@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lliubbo@gmail.com \
--cc=mpm@selenic.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