Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5646599pxb; Mon, 28 Mar 2022 15:27:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy09DambLBHOLDbqHH9lzXOjp4eiDAPbDxLVWa2hc7NUMFiwwVN91sz7e4QJx3rpfU/ovJh X-Received: by 2002:a05:6870:f109:b0:da:b3f:2b4c with SMTP id k9-20020a056870f10900b000da0b3f2b4cmr661864oac.235.1648506441465; Mon, 28 Mar 2022 15:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648506441; cv=none; d=google.com; s=arc-20160816; b=XbTPP2oncEjJCJdXMRNou7yxFhMoxz/4hxR0/7MYNzf+jB7+4AZRl7FclzUq7lygfo VZxIkRk5uNWhPf5+zajoTetzDdLD4ac114fNeUzhd743rOiCMxdoGiT8umZOK2slcsHL lyKFf2rvmcNo8G5klJi7ktbx010iPY07xNwQISmFmK+9mnphL0stxCqHvQOUl+sjfLtE 9tqmZAwhpS0GHR8XxTKOrwvNRCm4yvZzTSnEtQitcw4xXn5GyGMETIEQX78/02L87u7o vqFTM6PoETQot3uBNB9JQGB/qtaTCuhPpxBMbmgUPnvDdgX+knyaKtKw6v+fmSa7hf/s TZhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=w5EZQACvdAluDQcTNer5OdXMdfSlL1CBDPyqhMYl4QU=; b=DIcW2nn2/L5o/c0kFSztKMe6sRYkBGusRYyTQkTT5+/JtEMtUXUsylP48zjFVGAY6v ZrHKfXhxAdnL/D2pEcriCvNXlBErxmEFNWh4HGAWq9l1cANGptYvBgLP8EmGSsAurxUf fJ+7IG77pXNAVopCBooTcGEo4iWiX2qjn2IxYzcuhFVqeWglEdtR6MPniiL3zSefpugL 8cQORLB975TgwPbagj7k066o7U5tyV8859p8dOStctdpGx8UTRVBmno2jggY8egopQQW qNxV2xdegAeMf8iDoALJEoGQ1WsKmfZhJk5xrnh20JeAQTL3iS4jkNWyiz5odjEZWrCO XtnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o1-20020a4a6401000000b00324618ec796si12159055ooc.84.2022.03.28.15.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 15:27:21 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13D821B7556; Mon, 28 Mar 2022 14:40:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241968AbiC1LxE (ORCPT + 99 others); Mon, 28 Mar 2022 07:53:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243767AbiC1Lpc (ORCPT ); Mon, 28 Mar 2022 07:45:32 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42CC05AA7F; Mon, 28 Mar 2022 04:41:29 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KRrP11mQDz1GD9b; Mon, 28 Mar 2022 19:40:53 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 28 Mar 2022 19:41:07 +0800 From: Miaohe Lin To: , , , , CC: , , , Subject: [PATCH] mm/memcg: remove unneeded nr_scanned Date: Mon, 28 Mar 2022 19:41:44 +0800 Message-ID: <20220328114144.53389-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The local variable nr_scanned is unneeded as mem_cgroup_soft_reclaim always does *total_scanned += nr_scanned. So we can pass total_scanned directly to the mem_cgroup_soft_reclaim to simplify the code and save some cpu cycles of adding nr_scanned to total_scanned. Signed-off-by: Miaohe Lin --- mm/memcontrol.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index b686ec4f42c6..79341365ec90 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3384,7 +3384,6 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, int loop = 0; struct mem_cgroup_tree_per_node *mctz; unsigned long excess; - unsigned long nr_scanned; if (order > 0) return 0; @@ -3412,11 +3411,9 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, if (!mz) break; - nr_scanned = 0; reclaimed = mem_cgroup_soft_reclaim(mz->memcg, pgdat, - gfp_mask, &nr_scanned); + gfp_mask, total_scanned); nr_reclaimed += reclaimed; - *total_scanned += nr_scanned; spin_lock_irq(&mctz->lock); __mem_cgroup_remove_exceeded(mz, mctz); -- 2.23.0