From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760005AbbLCORg (ORCPT ); Thu, 3 Dec 2015 09:17:36 -0500 Received: from m50-134.163.com ([123.125.50.134]:45804 "EHLO m50-134.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752503AbbLCORe (ORCPT ); Thu, 3 Dec 2015 09:17:34 -0500 From: Geliang Tang To: Johannes Weiner , Michal Hocko Cc: Geliang Tang , 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 Message-Id: <9e62e3006561653fcbf0c49cf0b9c2b653a8ed0e.1449152124.git.geliangtang@163.com> X-Mailer: git-send-email 2.5.0 X-CM-TRANSID: DtGowEBZsuXYTmBW7SbMAA--.2706S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZF1DGw1Uuw48Ar1xCFWxZwb_yoWkZFX_Ca 97tw1UGw1UCrZ5C3Wjyw1fJFZFkFnY9FnFgF48tw1jyFyDKrs5tF1DC3y3KrW8Ww4rJ3sx C3s5Zw17Kr12vjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUbz6wJUUUUU== X-Originating-IP: [116.77.146.26] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiGRrFmVXlPqH1YQAAsk Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To make the intention clearer, use list_{first,next}_entry instead of list_entry. Signed-off-by: Geliang Tang --- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by kanga.kvack.org (Postfix) with ESMTP id 94E676B0038 for ; Thu, 3 Dec 2015 09:17:33 -0500 (EST) Received: by padhx2 with SMTP id hx2so69932746pad.1 for ; Thu, 03 Dec 2015 06:17:33 -0800 (PST) Received: from m50-134.163.com (m50-134.163.com. [123.125.50.134]) by mx.google.com with ESMTP id v88si12268982pfi.250.2015.12.03.06.17.30 for ; Thu, 03 Dec 2015 06:17:31 -0800 (PST) From: Geliang Tang Subject: [PATCH] mm/memcontrol.c: use list_{first,next}_entry Date: Thu, 3 Dec 2015 22:16:55 +0800 Message-Id: <9e62e3006561653fcbf0c49cf0b9c2b653a8ed0e.1449152124.git.geliangtang@163.com> Sender: owner-linux-mm@kvack.org List-ID: To: Johannes Weiner , Michal Hocko Cc: Geliang Tang , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org To make the intention clearer, use list_{first,next}_entry instead of list_entry. Signed-off-by: Geliang Tang --- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geliang Tang Subject: [PATCH] mm/memcontrol.c: use list_{first,next}_entry Date: Thu, 3 Dec 2015 22:16:55 +0800 Message-ID: <9e62e3006561653fcbf0c49cf0b9c2b653a8ed0e.1449152124.git.geliangtang@163.com> Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=GbHYB397YoI7oKq1Dx OVMp4QvI2r0ApCvK+ZbQoLbdM=; b=j2t6GmldPV5lzlyXcHr33+Gw5wnvS0zosg aeBBSyo1uD9ROzCbQHhtH3+uSrVeUDcwiN1229VXI3rTRciHkyrn4lBZVYz0MFAh IxiPRuljGn2xMkhsvK46/jHvm2ILtTMaKICcpMAJy2SI+vQmy5Z6dlZmOZoqmiWR sNI/z0oto= Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Johannes Weiner , Michal Hocko Cc: Geliang Tang , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To make the intention clearer, use list_{first,next}_entry instead of list_entry. Signed-off-by: Geliang Tang --- 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