Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp4054043rdh; Fri, 29 Sep 2023 09:39:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnfpTx08ONxyUqTcdzdfSy82ETA/EcdwixoI3+0Aqv3oMHKmELv0O11XToaY6XlWwFQapo X-Received: by 2002:a17:902:e741:b0:1c4:1cd3:8068 with SMTP id p1-20020a170902e74100b001c41cd38068mr7653894plf.5.1696005577674; Fri, 29 Sep 2023 09:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696005577; cv=none; d=google.com; s=arc-20160816; b=AWb5MoRRAdymrCqZqVhhKEhXWwPLNGmOKM3JAo9YM9C5MovAOWNkDcdZxvNo7rAVoO 81BSoDtnREh2Xj5XLXD5hvC1TAvSh0gwCw+UiPqwTkZSrvflYwTao1RI2SDPQFyVkNw0 +MbjKxkvQOt21t7tEiV7/zOFrPRV+ZJgHG6jjLHUSMNLOedyoKKOMX0/Jcs7JVk4KRZA R8QgMBeRJ4JqCJ31UWFna6Yt3ZpctlU2uOkc9Sp3BpcMksuVS9i9UsYpq9eyjdWiQS0p F5h2XGiG70NLfcr66nzwD02Om2vPg9P95o1VRnEDKnw6asmB6NQolyFDu9uMlbJhBx/b K4sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=MvOJgy48B1qqeyvTcx6jWjknArAYSXHsAq6fVEP2r78=; fh=OsxpHFVO0TTWpkd9nz9iIoXNJG/cbfzAlmsmMnvz/wI=; b=HIGXhehCHLjSJqTuSJ4/Jc+TEaCcF4feO4G6yZK3GtOTyu0N9I3O8O5ZrryRbvML6j K22kYTyw0nSPdg1dypNhhy7tYZ5FKL+BlsBocU1noCBBhYqnocbN+zAiBZRd3TmdDKFS XSIz0qwzkKEa8gt/uoiX0A1CiX7OXxPTp7A5czQx9Ji9IebkZzFls+kIhCOmTQcbuCas J/KxHisPYN3LSdlMkQfZI7KrIU3R1WiGRgFIzkUDIHohek/F2fPcZ3An4SnmL4xrig5Y TDqGhsTeXmojLaRs3kN2N8q+3H39Yro0P8IGCNtEphva4Dks/XApScwaKDOOn64E7dGU jSnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TmiPjF85; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x1-20020a170902ec8100b001bf1a9dbcc9si22811489plg.549.2023.09.29.09.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 09:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TmiPjF85; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5DC608115470; Fri, 29 Sep 2023 09:31:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233517AbjI2Qbt (ORCPT + 99 others); Fri, 29 Sep 2023 12:31:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233112AbjI2Qbs (ORCPT ); Fri, 29 Sep 2023 12:31:48 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 263281A7 for ; Fri, 29 Sep 2023 09:31:45 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-99c136ee106so1912822166b.1 for ; Fri, 29 Sep 2023 09:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696005103; x=1696609903; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=MvOJgy48B1qqeyvTcx6jWjknArAYSXHsAq6fVEP2r78=; b=TmiPjF85x5aBdt5hf8nnY+o/nIr+w1lu/XRU2whwrpDvReGLlMaYf8OyfMyPInQwGW U3D2wHzmeWU+6OmKBtDpSzGdL6yxD+l2TDSFTjFU1d3CdpL7+mW/6fmapZLbTyMf9rKF 5URjTe1jKal5/bDca6VQQw/0TWDN7U3G1T4g89HRjuUe9GMrqhGeBcvpV2VbpsIkfBbQ zCFkagRPnrBoj5JKIuTXiucPGB7J/9JeLDCjZ8rCD/ps5AfwXjUF3kR7x4Fv03Hc5JFU n7bUeIs8fNhug/WtpwoAlIwKllK8YvkQvEsakWpQ4TqECxPbbcT9enKe4YGM2OkHjfhj 8agg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696005103; x=1696609903; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MvOJgy48B1qqeyvTcx6jWjknArAYSXHsAq6fVEP2r78=; b=S0dUqY9Zo6QHjt4hpmccZ5I02sPM28jVnQf5Wt0+PIAzMxCKuw66DrKyd3dqFuEZuC bGqCOyQtb4AjldAXcn9NmiV0hzF6X/ck3O0DsKXxP28qNIB64+hOySeKCyb5xQ0KyKUn AQjOEoOvVLoi0TAwlAyMrfG2yepA3zizZDN0eOMv+dazmcgx+1z57j/MR1UTaKElGUVL lORYCJamZGieq4ZW9tTLbX1Et6UtBVQJkNA3dFwpV2g7fJ1/y7si87tdMRH+7H7J8bAH tr8CnXJImwGjtdsls4Rk8LWX1kuitEkJoi3aTSLFWAFmjoM2wS1uVKBcmEUcpsSL5Unl Qvpw== X-Gm-Message-State: AOJu0YyjV1UukGPte2opKa0ZrQNSDy5HVJ/aCd0b+HtTIq3YiFDe9Ikz wmHRVeOkvnulDuoqOUfq7xu2vrlp2A== X-Received: by 2002:a17:907:1dcc:b0:9ae:406c:3425 with SMTP id og12-20020a1709071dcc00b009ae406c3425mr4817704ejc.0.1696005103256; Fri, 29 Sep 2023 09:31:43 -0700 (PDT) Received: from p183 ([46.53.252.219]) by smtp.gmail.com with ESMTPSA id z11-20020a170906944b00b009a5f7fb51dcsm12595163ejx.42.2023.09.29.09.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 09:31:42 -0700 (PDT) Date: Fri, 29 Sep 2023 19:31:41 +0300 From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] proc: save LOC by using while loop Message-ID: <82c8f8e7-8ded-46ca-8857-e60b991d6205@p183> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 29 Sep 2023 09:31:56 -0700 (PDT) Use while loop instead of infinite loop with "break;". Also move some variable to the inner scope where they belong. Signed-off-by: Alexey Dobriyan --- fs/proc/inode.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -110,18 +110,15 @@ void __init proc_init_kmemcache(void) void proc_invalidate_siblings_dcache(struct hlist_head *inodes, spinlock_t *lock) { - struct inode *inode; - struct proc_inode *ei; struct hlist_node *node; struct super_block *old_sb = NULL; rcu_read_lock(); - for (;;) { + while ((node = hlist_first_rcu(inodes))) { + struct proc_inode *ei = hlist_entry(node, struct proc_inode, sibling_inodes); struct super_block *sb; - node = hlist_first_rcu(inodes); - if (!node) - break; - ei = hlist_entry(node, struct proc_inode, sibling_inodes); + struct inode *inode; + spin_lock(lock); hlist_del_init_rcu(&ei->sibling_inodes); spin_unlock(lock);