All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geliang Tang <geliangtang@163.com>
To: Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>
Cc: Geliang Tang <geliangtang@163.com>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] mm/memcontrol.c: use list_{first,next}_entry
Date: Thu,  3 Dec 2015 22:16:55 +0800	[thread overview]
Message-ID: <9e62e3006561653fcbf0c49cf0b9c2b653a8ed0e.1449152124.git.geliangtang@163.com> (raw)

To make the intention clearer, use list_{first,next}_entry instead
of list_entry.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 mm/memcontrol.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 79a29d5..a6301ea 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5395,16 +5395,12 @@ static void uncharge_list(struct list_head *page_list)
 	unsigned long nr_file = 0;
 	unsigned long nr_huge = 0;
 	unsigned long pgpgout = 0;
-	struct list_head *next;
 	struct page *page;
 
-	next = page_list->next;
+	page = list_first_entry(page_list, struct page, lru);
 	do {
 		unsigned int nr_pages = 1;
 
-		page = list_entry(next, struct page, lru);
-		next = page->lru.next;
-
 		VM_BUG_ON_PAGE(PageLRU(page), page);
 		VM_BUG_ON_PAGE(page_count(page), page);
 
@@ -5440,7 +5436,8 @@ static void uncharge_list(struct list_head *page_list)
 		page->mem_cgroup = NULL;
 
 		pgpgout++;
-	} while (next != page_list);
+	} while (!list_is_last(&page->lru, page_list) &&
+		 (page = list_next_entry(page, lru)));
 
 	if (memcg)
 		uncharge_batch(memcg, pgpgout, nr_anon, nr_file,
-- 
2.5.0



WARNING: multiple messages have this Message-ID (diff)
From: Geliang Tang <geliangtang@163.com>
To: Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>
Cc: Geliang Tang <geliangtang@163.com>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] mm/memcontrol.c: use list_{first,next}_entry
Date: Thu,  3 Dec 2015 22:16:55 +0800	[thread overview]
Message-ID: <9e62e3006561653fcbf0c49cf0b9c2b653a8ed0e.1449152124.git.geliangtang@163.com> (raw)

To make the intention clearer, use list_{first,next}_entry instead
of list_entry.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 mm/memcontrol.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 79a29d5..a6301ea 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5395,16 +5395,12 @@ static void uncharge_list(struct list_head *page_list)
 	unsigned long nr_file = 0;
 	unsigned long nr_huge = 0;
 	unsigned long pgpgout = 0;
-	struct list_head *next;
 	struct page *page;
 
-	next = page_list->next;
+	page = list_first_entry(page_list, struct page, lru);
 	do {
 		unsigned int nr_pages = 1;
 
-		page = list_entry(next, struct page, lru);
-		next = page->lru.next;
-
 		VM_BUG_ON_PAGE(PageLRU(page), page);
 		VM_BUG_ON_PAGE(page_count(page), page);
 
@@ -5440,7 +5436,8 @@ static void uncharge_list(struct list_head *page_list)
 		page->mem_cgroup = NULL;
 
 		pgpgout++;
-	} while (next != page_list);
+	} while (!list_is_last(&page->lru, page_list) &&
+		 (page = list_next_entry(page, lru)));
 
 	if (memcg)
 		uncharge_batch(memcg, pgpgout, nr_anon, nr_file,
-- 
2.5.0


--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Geliang Tang <geliangtang-9Onoh4P/yGk@public.gmane.org>
To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Geliang Tang <geliangtang-9Onoh4P/yGk@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] mm/memcontrol.c: use list_{first,next}_entry
Date: Thu,  3 Dec 2015 22:16:55 +0800	[thread overview]
Message-ID: <9e62e3006561653fcbf0c49cf0b9c2b653a8ed0e.1449152124.git.geliangtang@163.com> (raw)

To make the intention clearer, use list_{first,next}_entry instead
of list_entry.

Signed-off-by: Geliang Tang <geliangtang-9Onoh4P/yGk@public.gmane.org>
---
 mm/memcontrol.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 79a29d5..a6301ea 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5395,16 +5395,12 @@ static void uncharge_list(struct list_head *page_list)
 	unsigned long nr_file = 0;
 	unsigned long nr_huge = 0;
 	unsigned long pgpgout = 0;
-	struct list_head *next;
 	struct page *page;
 
-	next = page_list->next;
+	page = list_first_entry(page_list, struct page, lru);
 	do {
 		unsigned int nr_pages = 1;
 
-		page = list_entry(next, struct page, lru);
-		next = page->lru.next;
-
 		VM_BUG_ON_PAGE(PageLRU(page), page);
 		VM_BUG_ON_PAGE(page_count(page), page);
 
@@ -5440,7 +5436,8 @@ static void uncharge_list(struct list_head *page_list)
 		page->mem_cgroup = NULL;
 
 		pgpgout++;
-	} while (next != page_list);
+	} while (!list_is_last(&page->lru, page_list) &&
+		 (page = list_next_entry(page, lru)));
 
 	if (memcg)
 		uncharge_batch(memcg, pgpgout, nr_anon, nr_file,
-- 
2.5.0


             reply	other threads:[~2015-12-03 14:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 14:16 Geliang Tang [this message]
2015-12-03 14:16 ` [PATCH] mm/memcontrol.c: use list_{first,next}_entry Geliang Tang
2015-12-03 14:16 ` Geliang Tang
2015-12-03 16:27 ` Michal Hocko
2015-12-03 16:27   ` Michal Hocko
2015-12-03 16:27   ` Michal Hocko
2015-12-03 19:27   ` Johannes Weiner
2015-12-03 19:27     ` Johannes Weiner
2015-12-03 19:27     ` Johannes Weiner
2015-12-04  8:46     ` Michal Hocko
2015-12-04  8:46       ` Michal Hocko
2015-12-04  8:46       ` Michal Hocko
2015-12-05  2:55   ` Geliang Tang
2015-12-05  2:55     ` Geliang Tang
2015-12-05 16:22     ` Johannes Weiner
2015-12-05 16:22       ` Johannes Weiner
2015-12-07 16:21     ` Michal Hocko
2015-12-07 16:21       ` Michal Hocko

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=9e62e3006561653fcbf0c49cf0b9c2b653a8ed0e.1449152124.git.geliangtang@163.com \
    --to=geliangtang@163.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.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.