All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/memcontrol.c: use list_{first,next}_entry
@ 2015-12-03 14:16 ` Geliang Tang
  0 siblings, 0 replies; 18+ messages in thread
From: Geliang Tang @ 2015-12-03 14:16 UTC (permalink / raw)
  To: Johannes Weiner, Michal Hocko
  Cc: Geliang Tang, cgroups, linux-mm, linux-kernel

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



^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-12-07 16:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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

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.