From patchwork Sat Sep 26 04:34:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Su X-Patchwork-Id: 11801133 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A54B6CB for ; Sat, 26 Sep 2020 04:36:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2DC69207EA for ; Sat, 26 Sep 2020 04:36:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="MA/gZZOZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DC69207EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=163.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1B48F8E0001; Sat, 26 Sep 2020 00:36:13 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 18AC26B0070; Sat, 26 Sep 2020 00:36:13 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C8368E0001; Sat, 26 Sep 2020 00:36:13 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id EAF6E6B006E for ; Sat, 26 Sep 2020 00:36:12 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A6510485A for ; Sat, 26 Sep 2020 04:36:12 +0000 (UTC) X-FDA: 77303950584.03.cough25_46017242716d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 7E5AA28A4E8 for ; Sat, 26 Sep 2020 04:36:12 +0000 (UTC) X-Spam-Summary: 1,0,0,91b07d72c333e0b1,d41d8cd98f00b204,sh_def@163.com,,RULES_HIT:41:355:379:582:800:960:968:973:988:989:1152:1260:1277:1312:1313:1314:1345:1381:1437:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1730:1747:1777:1792:1801:2194:2199:2393:2559:2562:2898:3138:3139:3140:3141:3142:3352:3865:3866:3868:3871:3872:4321:4605:5007:6261:6653:9010:9121:9389:10004:10400:10450:10455:11026:11233:11334:11473:11658:11914:12048:12114:12296:12297:12438:12555:12895:12986:13069:13311:13357:13439:13895:14181:14394:14581:14721:19904:19999:21080:21450:21627:30029:30054:30070:30075,0,RBL:220.181.12.11:@163.com:.lbl8.mailshell.net-62.50.2.100 66.100.201.100;04yfhpfc8cjxezy5p45dh9heim8tgoc1ewxcpycuwd5c3kte3m8isdjw1sf3hsh.6feg48c91ceuneh81hwwphmqyp1oazuwzo7z48xrk1gj69o7wnx7s4gx364snyn.y-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: cough25_46017242716d X-Filterd-Recvd-Size: 2621 Received: from m12-11.163.com (m12-11.163.com [220.181.12.11]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Sat, 26 Sep 2020 04:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:Message-ID:MIME-Version; bh=Nv8xi E7qsf+vORc2bIdtiQeE1xHTyVYHiZvju+0MMe8=; b=MA/gZZOZp3JsMLF9SlEoG mV46L2/GaweXEao1JCRlRJ8hJhEQ+uzVVSV02OJCzjcaZ9vsb9mjWiCzuMzJfiuZ NCHIZ4CE8ODIQ1K/FeIjeVBHx4qM/Fyg3QVcgTx6lO9fSab1DnZakv4ZeiCaaMg5 awKFiMUxR0e5jpFL29YEXc= Received: from localhost (unknown [101.86.214.224]) by smtp7 (Coremail) with SMTP id C8CowACnFEXhxG5fS4VPIg--.62503S2; Sat, 26 Sep 2020 12:34:41 +0800 (CST) Date: Sat, 26 Sep 2020 12:34:40 +0800 From: Hui Su To: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm,slab_common: use list_for_each_entry in dump_unreclaimable_slab() Message-ID: <20200926043440.GA180545@rlk> MIME-Version: 1.0 Content-Disposition: inline X-CM-TRANSID: C8CowACnFEXhxG5fS4VPIg--.62503S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrtFWfZFy3Jw47tF1xXr17Awb_yoWDWwb_Z3 4ktF1UKr4UXF1fGF40kFn5GrW3W34vvF18X3Z3tFy3Jr1UKw43tw40gFsxWF95C3y0g3sx u34ktrnxZr17JjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU0-Vy3UUUUU== X-Originating-IP: [101.86.214.224] X-CM-SenderInfo: xvkbvvri6rljoofrz/1tbiWRSrX1WBswcHrwABsw X-Bogosity: Ham, tests=bogofilter, spamicity=0.001671, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: dump_unreclaimable_slab() acquires the slab_mutex first, and it won't remove any slab_caches list entry when itering the slab_caches lists. Thus, we do not need list_for_each_entry_safe here, which is against removal of list entry. Signed-off-by: Hui Su --- mm/slab_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index f9ccd5dc13f3..0cd2821b7066 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -978,7 +978,7 @@ static int slab_show(struct seq_file *m, void *p) void dump_unreclaimable_slab(void) { - struct kmem_cache *s, *s2; + struct kmem_cache *s; struct slabinfo sinfo; /* @@ -996,7 +996,7 @@ void dump_unreclaimable_slab(void) pr_info("Unreclaimable slab info:\n"); pr_info("Name Used Total\n"); - list_for_each_entry_safe(s, s2, &slab_caches, list) { + list_for_each_entry(s, &slab_caches, list) { if (s->flags & SLAB_RECLAIM_ACCOUNT) continue;