Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp208960rdb; Mon, 18 Sep 2023 12:31:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7jOtJlMAjG+paNH0l64Bjv+fsS77KWCDBndKO0g6VDTgILqMBvfTQtr9O9G06K4glPDSz X-Received: by 2002:a17:90a:17cb:b0:268:14d7:bc34 with SMTP id q69-20020a17090a17cb00b0026814d7bc34mr8772970pja.20.1695065460481; Mon, 18 Sep 2023 12:31:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695065460; cv=pass; d=google.com; s=arc-20160816; b=QubGcyX7gW/Y60NDZ9MdZkTsfJSFMNpULqxo02rbCuu0IYlxvbZbYCEXrAhPr1Nh8X Bqrl4+2L6F0BIGqZrSz0J5F9Yz+gadAOHP6huiUn4GIG16jCqNtSQ9t36UxgdlIOuz/L dBpZhz9rBF3gy1gnlJlJt8TtHsq+m2gTqub+aGnV1hi45Hw9ogO1cTPkNg9IV4R81dKS n44i5EC11wZIhpZF6k7i7gIJTPPxA70LTcuWeBVFw5be7WRMBWEUs/WfvVmHlzvV+i/G wefLVdfanEH0hyfSILie8a/9c9YlrdKi/Vc7OeIg/Sn9B56HCZgUtHarY405g5PWYr0p mNAg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=x46bwXsN77+lQe6o5h3k6w7NeKuYfv/vdkjHeoe4ELg=; fh=VwzSUecxAT6u0tUciqWKmI+0DL+P7G+UebexPge55WY=; b=wB9pbcVMP16osHPl2jSWncvsGRVRIs2pvsWDitfve/tAueYbjvhWZ93e1QmpBVHUqe /yJNjkJhRdHDZ+5l4fVhL93TlHd8rm5nVObEr/0pIve2IXwaqe4+8fQAaQ35OAjXhyOG yF02sIP067MetDNRK1/rlrvpjm14axxjbvZ6CP3lcUb5bgtkGxNEFmR5H8QCb6ExkQAq h5o0BffWPMAdKbiURkpWA96yDm6GoXV0vGtdvEqSttXsmad5AovvqxGcLSbrv/EDGB+g CGxfSo6g1yvhPFrbQkjI+ow0FsE4mFB/B+q2WhOvdDxRktJRrbRvzRhmBs/gQZB2I+wL r1KQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=ifvnnANF; 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:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id cc5-20020a17090af10500b0026839b09526si8387143pjb.96.2023.09.18.12.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 12:31:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=ifvnnANF; 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:4 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 howler.vger.email (Postfix) with ESMTP id E22A48083AD3; Mon, 18 Sep 2023 02:50:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232034AbjIRJuJ (ORCPT + 99 others); Mon, 18 Sep 2023 05:50:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239281AbjIRJuC (ORCPT ); Mon, 18 Sep 2023 05:50:02 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2114.outbound.protection.outlook.com [40.107.117.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1869A8 for ; Mon, 18 Sep 2023 02:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jb5A7/nrjdTy0+oAlzOEmDyxIC+XF63BYCXjt06HD1yV5QJAodEyDc49+W7wrDbnV9awrh/3h0MU+YAIwkTtCgqEtsAkG02FMVefHXhpfeflIsy5PViNMEQvRCdPXFlQ9hOjFbHb8IGAyYBFmjs7zjDNV2ATT99e67bwVu9JXeHk7oJbXysvRDRuSXQ7j/wriHUeXbo3fx+fTx3bZOrUUcO/iPwMAYVNGhJGK8T/HJX2hbEmFvwaBC8UEs/xpcq+87LeCkoBL+LuYtWHQ6VCUjse2ChxBCnUIrTS1o3xtaiVLFvcBFbzhVnaeFE0ub/JbuOccvpI+Z0Rnx7vDkwl1Q== 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=x46bwXsN77+lQe6o5h3k6w7NeKuYfv/vdkjHeoe4ELg=; b=TEQLktqTPfX0ohv+rMEpGVh9F8r0C/T7OdJ4odvMM+J5xvAPHu3w0Ij7n8671vNoP4lMVrMoAgF2owqwU3qyGk9VGMR3hQqQ8cGdvb1NG8cXjzG4Kzqu8Di2pL5tR8y1t5Jp/qMYXJbbBFyqa0JliygYTc++s0HQ1l0ax07Fqa0mDYAC77CwwzQVNP7wBdGuQ4MC5PemK9pb9upP6cnIPTCmx6czbx3ya/upt0hER8PwFoS0mIdLgYr8PHDwcNeDUkys3EoW039quBY9C+UjPljvSN55AmaaMNEG88RkAmvAE+3sH5oTOpQWo8j49M3dWyDlKQWwRSUXEZ//the0RQ== 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=x46bwXsN77+lQe6o5h3k6w7NeKuYfv/vdkjHeoe4ELg=; b=ifvnnANFgbtpFJ8y0VZIYCHF28D51pc3DYSAh1nev3FhAVgE8LIQADU2qbJwB9XS53xQvfBVn7yyRXZA7YMpg0v4+HDS9IOX1bFNwfSRDyYF52rcSIqnVF7+7UVW7UEz0VnBAM8lltAg1Larr9g4AF7HDbl/assIWMb6jRQ+f6JCEoIhQJdcKydEf1PXWlMPC2/1X45iqaANgdsIchxFzcjzRqd5XvXRX1Da25O58y0Z91+8Z1rOhHq7bg0zaWgbpx1E8g/Dw78Q+QkwUVU6qH30JqwooiLG5cCDGyiM+1FbGWorFl2drCpN6B3bZJQdUISB2ANc1Rat66hM4aw9Ng== 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 PUZPR06MB6266.apcprd06.prod.outlook.com (2603:1096:301:11f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Mon, 18 Sep 2023 09:49:53 +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; Mon, 18 Sep 2023 09:49:53 +0000 From: Huan Yang To: SeongJae Park , Andrew Morton , damon@lists.linux.dev (open list:DATA ACCESS MONITOR), linux-mm@kvack.org (open list:DATA ACCESS MONITOR), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com, Huan Yang Subject: [PATCH] mm/damon/core: remove unnecessary si_meminfo invoke. Date: Mon, 18 Sep 2023 17:49:34 +0800 Message-Id: <20230918094934.18123-1-link@vivo.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYCP301CA0046.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:384::10) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|PUZPR06MB6266:EE_ X-MS-Office365-Filtering-Correlation-Id: f2335658-a519-4067-9a96-08dbb82c9ba9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +GeVIO5aiL7Ls+3vHP1Ll0XLu8qVZfkqYE5UYoVeDIH+Im+iOEZr96oM9IpTfZCDU7sD8t+4d8IfEZuvvYPaqfCYWVhV1Aa9DdW3UUto7RqBE3m6d3tKkXoeyrduX+2Gi1YByygPLHOsKpI4A8rWafSn0dNoE2Bvla7r+ctknFFqb3mQ+6c24ovaQ76WKpFPmUi/vdYc5NKTtohqLwSdwAVueVh8nCLSa5h7uU2+HqqwqlJza35Jx0tTA4dNRaohxuifQRDYsbByPasOTfh+oLG85fC24ojuWjgJnOHfjgnOQ7DIFOckYaRtcM2kW8XyI27R3hEgm+E9N4zGXpkxDhgzSJtTTjZ1tSXdLKf6dFc4yBRwb7sGNPPBlea+HOkAApIuYPMDv7Kfl0IYmUEeCPfwCKdKIokpTm715S0sonF5+HAVaNGWXLd0A5fGl6Fs/Gnp4pQrfKvk/iXsNG9QkPFN6zhTuONEY8Jxc5Ax/s0wPJyQ2FJMLKM8YLI40VdnCKH3ez9/AceakY7QEOg/oMhXfqpnEyVvCkQvPvPdtnnEkwtGN49oCEbjyAfIEVskBJpRzQ4n7Lr68mPvQ6EC5nLUAMKEBYHU9+Ju/jWO7su8cbv8PUvDYr6xawGMM9c2 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)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199024)(1800799009)(186009)(478600001)(4326008)(8936002)(8676002)(316002)(2616005)(110136005)(66476007)(66946007)(36756003)(66556008)(5660300002)(41300700001)(1076003)(86362001)(26005)(107886003)(2906002)(38100700002)(38350700002)(52116002)(6486002)(6512007)(6506007)(6666004)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?U8DZ8QS9srUlEmmNB40yF5K18BnAhZ2xhLPw09yzom6tEyX4goO/q/zr0aGA?= =?us-ascii?Q?AlX1UX8nipr5WPJO1vbDv7vm9t1TMaPVQheu31DC0Na1IPDgZf4erBjSWQNc?= =?us-ascii?Q?Xmbwe8CPH5BF1qA87TkODffJTloahiwMBt5a2LaIsblKfSl0BJB7WVmYDFAU?= =?us-ascii?Q?Cfug8yWnR29B0C9SSIj9hYfN5d+RDTB1XEfObkWCTAHOv0D6RPZCfeRu2rcg?= =?us-ascii?Q?q+xfbrmDr5kxbUfB/PeE4VLOFdsA02mcnmT8eLbKtt7As2X18m2S/oMLqbpF?= =?us-ascii?Q?Sc9aPN85D8vwOKoTDL7ixoI7jXdYC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uP22fjfaZchkdPRPpPpEwAeu6s+/4hNGYm6WsoktDWx0S3vOrB7Y?= =?us-ascii?Q?Rzsu0FdaDwfQHSph0yiE1HiATAHRIU33Z6ux9l0URIbImrNn2NZP82Bde56r?= =?us-ascii?Q?RJP4y8yCAHA1d2ng5x7viLyzpCPf2UPDf05iIl9GQMnFNi+xllJwZN5Zb32B?= =?us-ascii?Q?Hj9iqjZwuWOeXf9LySaduCmtDPXpSim0mBqa6SGgeyfKB9plDJrXwD2Q8l4O?= =?us-ascii?Q?TuUuokxh453Ut6ChRZc4xX2vDZnN+u8eY0M4RJoqK3gz9y2iFgOeqpKBxMLB?= =?us-ascii?Q?wr00zH2v1E25yxkK0LxW9Mx2ved4AqitrOQatQN/EXBWHmxeYMNzd2Hsq8Tq?= =?us-ascii?Q?yQS23nbnklRcYutbP+MNGMf7GoPIfg1ZdB5+CTY5?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2335658-a519-4067-9a96-08dbb82c9ba9 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2023 09:49:53.6145 (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: ZGyshqNxMDdh15yX0DsV2EPjqLcVKDi4PTx4fQq3Pq8nZkNGVdDERGl787hcHF2Iz5p8pv9nhnYg3nfoApeQXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB6266 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 18 Sep 2023 02:50:49 -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 --- mm/damon/core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index bcd2bd9d6c10..1cddee9ae73b 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1278,14 +1278,16 @@ static bool kdamond_need_stop(struct damon_ctx *ctx) return true; } -static unsigned long damos_wmark_metric_value(enum damos_wmark_metric metric) +static unsigned long __damons_get_wmark_free_mem_rate(void) { - struct sysinfo i; + return global_zone_page_state(NR_FREE_PAGES) * 1000 / totalram_pages(); +} +static unsigned long damos_wmark_metric_value(enum damos_wmark_metric metric) +{ switch (metric) { case DAMOS_WMARK_FREE_MEM_RATE: - si_meminfo(&i); - return i.freeram * 1000 / i.totalram; + return __damons_get_wmark_free_mem_rate(); default: break; } -- 2.34.1