From: Michal Hocko <mhocko@kernel.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Vladimir Davydov <vdavydov@virtuozzo.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] mm: memcontrol: clarify the uncharge_list() loop
Date: Fri, 11 Mar 2016 09:19:52 +0100 [thread overview]
Message-ID: <20160311081951.GD27701@dhcp22.suse.cz> (raw)
In-Reply-To: <1457643015-8828-3-git-send-email-hannes@cmpxchg.org>
On Thu 10-03-16 15:50:15, Johannes Weiner wrote:
> uncharge_list() does an unusual list walk because the function can
> take regular lists with dedicated list_heads as well as singleton
> lists where a single page is passed via the page->lru list node.
>
> This can sometimes lead to confusion as well as suggestions to replace
> the loop with a list_for_each_entry(), which wouldn't work.
Yes this confused at least me 2 times AFAIR.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Thanks!
> ---
> mm/memcontrol.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 8614e0d750e5..fa7bf354ae32 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5420,6 +5420,10 @@ static void uncharge_list(struct list_head *page_list)
> struct list_head *next;
> struct page *page;
>
> + /*
> + * Note that the list can be a single page->lru; hence the
> + * do-while loop instead of a simple list_for_each_entry().
> + */
> next = page_list->next;
> do {
> unsigned int nr_pages = 1;
> --
> 2.7.2
--
Michal Hocko
SUSE Labs
--
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>
prev parent reply other threads:[~2016-03-11 8:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 20:50 Johannes Weiner
2016-03-10 21:30 ` Andrew Morton
2016-03-10 22:16 ` Johannes Weiner
2016-03-11 8:19 ` Michal Hocko [this message]
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=20160311081951.GD27701@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vdavydov@virtuozzo.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