Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932950AbbLBPsl (ORCPT ); Wed, 2 Dec 2015 10:48:41 -0500 Received: from m50-138.163.com ([123.125.50.138]:50367 "EHLO m50-138.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932253AbbLBPsi (ORCPT ); Wed, 2 Dec 2015 10:48:38 -0500 From: Geliang Tang To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton Cc: Geliang Tang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mm/slab: use list_for_each_entry in cache_flusharray Date: Wed, 2 Dec 2015 23:46:12 +0800 Message-Id: <22e322cb81d99e70674e9f833c5b6aa4e87714c6.1449070964.git.geliangtang@163.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <7e551749f5a50cef15a33320d6d33b9d0b0986bd.1449070964.git.geliangtang@163.com> References: <7e551749f5a50cef15a33320d6d33b9d0b0986bd.1449070964.git.geliangtang@163.com> In-Reply-To: <7e551749f5a50cef15a33320d6d33b9d0b0986bd.1449070964.git.geliangtang@163.com> References: <7e551749f5a50cef15a33320d6d33b9d0b0986bd.1449070964.git.geliangtang@163.com> X-CM-TRANSID: C9GowACXzfVLEl9W7118AA--.14570S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7XF4Utr45tw13Wr1UZFykAFb_yoWxArg_Ca 97ta1rCrWfJr4fCrWrtwnrJr9xuw4I9ws7Wrs7tw4UAr9xGrs5Xa4UJFW3WrW8uw4rK3s5 W3ykuFnxGw1IgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUUMmh5UUUUU== X-Originating-IP: [116.77.146.26] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/xtbBygzEmVO+gRZzwAAAsS Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 922 Lines: 40 Simplify the code with list_for_each_entry(). Signed-off-by: Geliang Tang --- mm/slab.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index 6bb0466..5d5aa3b 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3338,17 +3338,12 @@ free_done: #if STATS { int i = 0; - struct list_head *p; - - p = n->slabs_free.next; - while (p != &(n->slabs_free)) { - struct page *page; + struct page *page; - page = list_entry(p, struct page, lru); + list_for_each_entry(page, &n->slabs_free, lru) { BUG_ON(page->active); i++; - p = p->next; } STATS_SET_FREEABLE(cachep, i); } -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/