Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1027111rdb; Tue, 19 Sep 2023 18:58:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEM54fsy89+IbkhT5SBO/SbCdMMbfvr9th7qhCL4a+jGdrLTIzQ7nxTcZmSv2t5eSHA70TM X-Received: by 2002:a05:6808:bce:b0:3ad:c604:ba4c with SMTP id o14-20020a0568080bce00b003adc604ba4cmr1129233oik.59.1695175128758; Tue, 19 Sep 2023 18:58:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695175128; cv=pass; d=google.com; s=arc-20160816; b=tQiyUJM8pBM0V3VigWAO28z27Dsln7c9uRKn4wBj4atD46F/NNTp3fMOCvG67Uex4v Ygt2fcFEl/cYtNBE8kTFNlo8OQz8ZRzEHQdnOFwgBsY7fWOBHjHemZP2xtXJIvxFN1IS 3WHHjGpcbbujZNl7y9owPCr8cWHWK6mOlY8J2LC4nki/k6QOq0KfI6S5I7+cIQD/6TBM KQi/ha6nWdKwbWdZp7s9LGJ+vsUy1FpxtK+OJpH/MDYgVMamZYuFepMa8v/Co4OwF3nr uEkXXQRQCoqHTPoCXZ0StxYH8NpXpdMPFkikZND+5Vk0r2hg3hraK2uj2eXdq8fLq2TX Fogw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kwFZKJqP6TASZx+Y2sllK4SrBIaFfq9nVZikO9rzKyY=; fh=nM7kSDZ8vRlZ1oT/woeq4gJXqVQjIKSuHCu4mT+tCMU=; b=Fk3gGSyvvELOHWZdOaAKBsf357zAhfBNCKm4gJ98UEGQqDKuepKNDYiycZjXEOEA8t SKPq1MIMrwFVs2ceBKTtXkiXmSfw/6oHssfPAjafkxEjyxtQy3iensRurOgJwiZtqxqX xiS7+sLCw1t6bCBlGYglMFLP/vzMO4pIS3w+wU44u9uHdAYcToR7ikgX2XXtjowfMnTu prSC2jzThoD54XjScJOKt1e7FVtu9GeUlwQVN5smSs88A639zMeZqR6nzV7uyzPNGm6X 9Xc2rXaexVsiXewQjJIQWffh8M3cgUYnu3s/y7R7Wa1maKZEcapMFV/crZrEqgwEPsHT QCeg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=kpTjzCnt; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id b26-20020a6567da000000b00564b8e55214si10550702pgs.385.2023.09.19.18.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 18:58:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=kpTjzCnt; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BD0D6827D0C2; Tue, 19 Sep 2023 18:58:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231174AbjITB6n (ORCPT + 99 others); Tue, 19 Sep 2023 21:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbjITB6m (ORCPT ); Tue, 19 Sep 2023 21:58:42 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2134.outbound.protection.outlook.com [40.107.255.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 809B1C6 for ; Tue, 19 Sep 2023 18:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QTgWJXElbecwRC00v6lsTYff98ggPgovh0zYmk7oodQvXOq7MOYjtGeaOf51qLqvQVnzbj6XSxhGaIO2eLL9W1xPLgGcZGioFPPeOKog3HOLTtnwoC+3+Fj0ZBKmdQcbCEOeSL7BVEAJHRWY38F7QxnYzCT+vIxyheFeHsCBgQvKMKF2hD0HUescgQfU589aGI21Xv3PlrfBwcgOD0ovLBYdMHXpxjUONTZFsL7dqQQ67X6hk8XlbA0MhGp037UwCJxtUHpl7xIuFqJqCrk83HHrap4sOyE7aDJlR4bYSseSfq6bsA6vyfSDCR2OsKKghPY/3IS6EAkNKhLdKsblAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kwFZKJqP6TASZx+Y2sllK4SrBIaFfq9nVZikO9rzKyY=; b=mqlb+OnhEvHkUddjeJZJCug8K2DyGTJADA5IFz0P8qHQJsJKQF5kCxrzT5R7M5A6bp++Q1yZunMOPJpBgRKc8rgnGuy7sohGAPiGom862PR/3fiF46AO/nWOycsDG+t5666Ne9Vanfu23qLjIEAxUTgmhmakT3ZsuXLZaLvBaseU5MU3j+xicKVpC8lmnEYzmhftqA1d0OFtaiGHdT9KkLQrnbsB0/iLpFoS5a93NqlmRFnrj2keU9Hq84Hn8KOaZVI3Lp9FdNBOR3fyirmTa5906WAemHW429CZYQUrI3Mo0XGps4Kz8wRsLH/4SNoIXPWWa5pP8pGkCYE9dACV/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kwFZKJqP6TASZx+Y2sllK4SrBIaFfq9nVZikO9rzKyY=; b=kpTjzCntSwFl10eVfWLJ+QWJI8loUlrv9JLF4Y4HZioYfq+rNRnrUK6k8uyirwYw7bEsliEqckqsd1bLHfnJvb7F05VEBirVbhXV2z1qH5FLKRkP335iKnAAX5fQdVZBQUTPyd/x6Y/+x4ECmOqOFEZoSNzjbZujKxyOEzK9p8Y0sSogQ/Xc3YR5XSeUp6l1+oJ30Pi3MLkyVAEvkNrc+p/q77ikNdaSqxIgZIOkQcDmjTErFHcazOd2ZZJT5/nbn9YRCOvJoA+5SR7RAs7u3xzQ2JVYSX1BoIbVLoP47Srcd/hxKQ5AIRnpgk7KTb+p5eTOF4qoWwNY/1AYsxjPyg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) by TYZPR06MB6954.apcprd06.prod.outlook.com (2603:1096:405:43::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Wed, 20 Sep 2023 01:58:33 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::64c1:bd7f:ced7:7d02]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::64c1:bd7f:ced7:7d02%4]) with mapi id 15.20.6792.020; Wed, 20 Sep 2023 01:58:32 +0000 From: Huan Yang To: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Huan Yang Subject: [PATCH v3] mm/damon/core: remove unnecessary si_meminfo invoke. Date: Wed, 20 Sep 2023 09:57:27 +0800 Message-Id: <20230920015727.4482-1-link@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <7b38eb40-1d74-4308-ae9a-b6aa91a46833@vivo.com> References: <7b38eb40-1d74-4308-ae9a-b6aa91a46833@vivo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0116.apcprd01.prod.exchangelabs.com (2603:1096:4:40::20) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|TYZPR06MB6954:EE_ X-MS-Office365-Filtering-Correlation-Id: 4df8955f-c3c3-4611-e571-08dbb97d17e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K6QsMJCQTunNPyWXMyi0vUBRY2slg3Yr+1oHI8++h0o9zFAWAa2q/6Xp76zH345BJBkOjCSGDBg7M1aUTbF+BYTKaoh5eqJ79poZsXF5cRGQu0IT2Wyv0glf9G2NyXxg2ndgIEGbFrkb/rUxnHuWUdZqRropjxJi+zXAuS18xCNodmpkS3VoS9yxiKbrXMpowOHnZMeg0nuCzDNhySXfMe7bf/D0eEIrzmsgmXU8kU3Zr/HF+fm6exwarBddfM20Elr9UZkoU558+cfrAJZVJo2HLVS/gdkhxI22Mp6yLT/dYc935mfzpWzmWrcJOEl3Y4s4hOo4wBee/Lyfmy9plZPeXgWiUppSImATJP9npvtWzVl00cof7gRz6zeBDPA3vyiYXqg5lR7bmoR0/im4e/a190q7eO3LyRYHf3axLmq0VgcNP8wHUA+6xlISuxptOUbmli2Pa0sceUhPelpe6gcqnaV84Be1kOBPguwCADlkAqs6lxXqguzfNGG8d1bkA7MsysHonsLdppdA49DiY0U7FFMaYR46imVKEhnsqVzIjI7nOVaS8zxjNh1cVYlyfoMxb7IZ6/T5n9z9aZc4B480+oM2olm/VQZO9cY2dRcabkAwqRMz+YquYi9d+hOz X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39850400004)(396003)(136003)(366004)(346002)(376002)(1800799009)(186009)(451199024)(83380400001)(6506007)(6486002)(52116002)(6666004)(86362001)(36756003)(38100700002)(38350700002)(4326008)(1076003)(107886003)(2906002)(8676002)(26005)(8936002)(6512007)(2616005)(478600001)(5660300002)(110136005)(41300700001)(66476007)(66946007)(66556008)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uGiiGr5Slk+c71/58ubIdJ2e6n29/EqsyTpDubSFRT79+nvvvTANGgXa05jB?= =?us-ascii?Q?ka8FaZ5MTZy1cGQ7DlrHQmbAXZGeaw4pH4BUkWg+lZvJEx1KDS3WqqVfO+vO?= =?us-ascii?Q?bODV/aP64ZCygZJWQinGHMV6eS/400PVzIF7srDwvS2iwJpGUj2+Fzni7GdJ?= =?us-ascii?Q?8xJBZINOwnMv3BaXYvjYe0rKkGKVPcS5o1V/f9iFpAhLO/itpXe2fqKv/PHH?= =?us-ascii?Q?DW8tL3KcIkNybQuFNWSAh05bz+e9MvXdJimtiwIwndlJDsRPG68o1bO5WlZy?= =?us-ascii?Q?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215/Yo7Aj2xNwCyLMt/niIM37icZo?= =?us-ascii?Q?j1CR9Gm39PG73+GUGlKOX9FW3G2lo/O4IuSRj20doxoaTx2B9es2jquh+m1U?= =?us-ascii?Q?clcAxM7/1/56QKfyiE5pnrACNyEXJZpbvp16tI5hD9YhPCOUhy+h6JwM7eh0?= =?us-ascii?Q?WxK1vDIMvRdbRgGJt7Imc4FbglhLSOlXML0ckVSpGoW7vhDhoLFh0YdIgoNZ?= =?us-ascii?Q?xfgQk8f8Tj4OmsSACVD/XGWz2WyeFn4StALOF5vdOYuvzVzwqOq6twnDLb8c?= =?us-ascii?Q?jhCXH5O8+uZ20jD9VaShvh3Ub/6k120AMcn3CCrRaTHOyWl4jAW7bRr+6lge?= =?us-ascii?Q?lmFqELabhT1TYCVPX5E2m/7NdK+WgFDLZTZpsvO5CXl6o5+rAHmGb8o0kXsM?= =?us-ascii?Q?Si6veQ8fX8YEWFy1vPdz32rXiTX67h9CS9uEvlzN?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4df8955f-c3c3-4611-e571-08dbb97d17e4 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2023 01:58:32.8529 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JmtY0Cz8HzitpF8N+RNy0TXqk79KD/ijUx4huF+/s6s+sLBRdbyCY007Of2dfD8gEF4xeIcwqFJac2DktvsBSg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6954 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 19 Sep 2023 18:58:44 -0700 (PDT) si_meminfo() will read and assign more info not just free/ram pages. For just DAMOS_WMARK_FREE_MEM_RATE use, only get free and ram pages is ok to save cpu. Signed-off-by: Huan Yang --- Change from v1: v1 fold free mem rate logic into __damos_get_wmark_free_mem_rate and not invoke si_meminfo, just get free/ram_pages in global. v2 cancel this __damos_get_wmark_free_mem_rate and just calculate rate in damos_wmark_metric_value to keep it simple. v3 fix changelog format, fix code style. mm/damon/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index bcd2bd9d6c10..6ceb52298904 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1280,12 +1280,10 @@ static bool kdamond_need_stop(struct damon_ctx *ctx) static unsigned long damos_wmark_metric_value(enum damos_wmark_metric metric) { - struct sysinfo i; - switch (metric) { case DAMOS_WMARK_FREE_MEM_RATE: - si_meminfo(&i); - return i.freeram * 1000 / i.totalram; + return global_zone_page_state(NR_FREE_PAGES) * 1000 / + totalram_pages(); default: break; } -- 2.34.1