Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1145445rdb; Wed, 20 Sep 2023 00:21:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGU9LwLgPzgwmjpbmWvaafC75yBCUZtPM94vKjSKJf5p1pqQIuVG77B7Ma4kQbqdNf4mY/I X-Received: by 2002:a05:6a20:5606:b0:153:591b:4101 with SMTP id ir6-20020a056a20560600b00153591b4101mr1659472pzc.49.1695194476154; Wed, 20 Sep 2023 00:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695194476; cv=none; d=google.com; s=arc-20160816; b=SvSuOkv0y+HDmfPt2fiIjB6fxtYK+tVhGpmNfiHXiElZtihcgDG1oLCcWtBa/zhDci WGlF8Da3DdFBELjWdh7wmCVB/mtAY0c9oHSDHmGF14A2CwBkeGj/6fzGxFuiFo7eZzMe Ngo1OpAkmaWPTMR78De2xjkqql9HMjy0M1M+lLkkvv7tiIemavjTK4M3PFXUSdtAuynP CWrqBO/Vh1KjJqXaEF66/ckYngWtOuhgP5wID14Fm+BORwmmQoykwudycUZRcySlHjtO /WoGUjDKdtcrj/m4kg0SpzzCn1oL67BaBU1QJuUZdyBzRmZ8lfbGcyepH2j5PTZHbpA7 zjuw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CZZs8q0zUsaCoRa8g+is75D/jBOv+EOJO5yetOqznF4=; fh=W+Dq4InbyxEX2TLoQu4Mgu8iZ6x4/eco5J08yWDDwBA=; b=Ztdi0B3qv4QSwV00SK6Fe1rSyT40wudMPkuGLn/J2TOTAxhILrPShpZ5vH8u6oGckD +ad5w27UR9XInT2xzgE1rNuSU1mkR6OgWen+yWr3eFtnrUI+RpkL4am2YF+oFPtPQG5O XbkPbFEKfHkJw+0SsW+zE8gHQqLE7zDIU72gvY6a05+LZNgh7Bbehszz5e6cme61Z10a eXhEPBi5e9cD0/OS01tQIyvYCYhswreWxPunS0fWXSgLhx/pmP+LD7cZV+cadwAZbhE3 Z1M474KTOXAJGKbD/R/QD95Kk27nyC30UK5zRBM/WSTr/7OgA29t1SA+raJO62qqdEzR 9pww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="JwJfNw/l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u20-20020a056a00125400b006901504b6a3si11413788pfi.153.2023.09.20.00.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 00:21:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="JwJfNw/l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 2A22480BB5CD; Wed, 20 Sep 2023 00:20:03 -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 S233638AbjITHUC (ORCPT + 99 others); Wed, 20 Sep 2023 03:20:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233662AbjITHT7 (ORCPT ); Wed, 20 Sep 2023 03:19:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4043ECE for ; Wed, 20 Sep 2023 00:19:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4550FC433C8; Wed, 20 Sep 2023 07:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695194391; bh=qFdKBzqTmmQ2nUPNK5GbW1ZYNZ25HnBX2G2O6O2qgtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JwJfNw/lMLXQffIjVCXrlngljneOT1KsD/CT/8dx3/6vAVvsTcZnnJ1wTHnCl3Dxw XVGw5FQj7scOr7UQIxB8HR9uSOUorhtAo4kd+tgEtBXjsjQwzhQZTeXgnGNdUACt4D 9beTUeZFLL7xehCRZzEPLn3AjkYwxquqQBZrAlX/KlOr6EJk2yTeZxJou3Ako5IG/F 1OHIY7IxbA0ypJHv2yVoW99OewAZqs9frGUN7abb0dOwEiF7uLiMtu6fUpyGDmikuf 9dZalQI5eoc2NMridpMayTavc4YYmAiZhddH1DD9OfrB9wxzfL7NgtspXoHi358r6C ps4EoiYlOWEkw== From: SeongJae Park To: Huan Yang Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com Subject: Re: [PATCH v3] mm/damon/core: remove unnecessary si_meminfo invoke. Date: Wed, 20 Sep 2023 07:19:49 +0000 Message-Id: <20230920071949.26063-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230920015727.4482-1-link@vivo.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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]); Wed, 20 Sep 2023 00:20:03 -0700 (PDT) Hi Huan, On Wed, 20 Sep 2023 09:57:27 +0800 Huan Yang wrote: > 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 Reviewed-by: SeongJae Park Thanks, SJ > --- > 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