From patchwork Sat Sep 16 02:09:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 140882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1438240vqi; Fri, 15 Sep 2023 19:23:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEI1mGCRFcyxQHwIZP9utnHqY+IzY5HKv8wvwYHTS5PiDSaGI74APpn+k9D+gbnfUdodVT X-Received: by 2002:a17:90a:bc45:b0:268:18e:9dfa with SMTP id t5-20020a17090abc4500b00268018e9dfamr3331544pjv.5.1694831007829; Fri, 15 Sep 2023 19:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694831007; cv=none; d=google.com; s=arc-20160816; b=qw6CC8jXBO5NFhTuYQDJ+Q4e4wijuanBYJmEdCzA+XgnzwC6LD9NOqe2AY/kfnsMUN m5Dm7OAj2JM7/5rYVPTYy1dGqCqg9/WyzeCeVy/DLwgPGMUFs7jHooyMxo0ZYaSX2NQO 55OKbW0wBItL4MBiOEZnaXKB4ckVOSarBTpaoEzX32G3EiBbGq18DdCZ1fDATvvnTQXN ujHHf9Bvr2GJ1Dx5dpJCqZiHB6gSqJbjJRTnTgcJTxoxqoQQAMH62OdWwiVdkiKbu9u4 m9ckfKsaoxnRpxRShiTRxJrht7RdhfmDQYmXRKIMTW0ekuaE94B+DeGYEYZZscnepRwI zcgg== 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=mxS0NDdtbPRnU18dk9+OTOoH37taYp/+bQDsW+ALhsc=; fh=BzdeVYqZhG5iuwuKJRNLP969rvCput73lx0iwx2zu7A=; b=pmdmmOk9fCl0hhDlNfjRtRTwSkZ8g4zPtt9W0j6lbQmBgGa3FnM0txMLm/K/vOvjIM 2CeqEBhfLFeave71dw2tVIKQWvPerdSIOoWPRy6Lj7yAoSkZgcVGUk6IJ1U2SYRrh8ZN UvI0mBmWZt466oY1hqUXkSeN7xlnpCED0DYZQUb8J0ZK9FYfAih6I7EFua+HZ9rHjb2U cOkTM/QcCe06Ig6JFU7Y9FIldFZIjEKYb2v03hDzcbhkbc5DO2GqauMbwiUyjIazhE3K UPKDMA6+KgqkyE3jH+VLIjH2idVqoF92T4+EZGWsU9Vo4dGWFwXlFS7QVwYJBc+OGdWS vxtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DE5n19QT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id co8-20020a17090afe8800b00268278c51e3si6180032pjb.49.2023.09.15.19.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 19:23:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DE5n19QT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 8CDBE826C0E0; Fri, 15 Sep 2023 19:11:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238295AbjIPCKW (ORCPT + 27 others); Fri, 15 Sep 2023 22:10:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235752AbjIPCKB (ORCPT ); Fri, 15 Sep 2023 22:10:01 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 867D6173C for ; Fri, 15 Sep 2023 19:09:56 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC149C433C8; Sat, 16 Sep 2023 02:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694830196; bh=VEo1bT4L3oASolFpAiFgoKtkxwTv3u9FxZ+yfBw7tjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DE5n19QTrLA/q3MCbj6txVWl1uVLgvfvimtQFgvcddmHPnYMGBO3fFDzwOKCAE1Ea 6ZYLcxHkm5CTWFprrqRjF2KtaYm2Pz1lRDiwdDYTuq77AJA0RSUh5o65EYEXrOnEHs xWMKylLYUB2wBv7QR/yROAzDf7cNTsquwx29G72dwKWAZ+EmwIigZOPRJm/YCHaQd8 oGtGCMonOLobfZnVSyKN0ZWlbECSyGnvfq2vefdC/SACWvKlxDcHJ9gAJk10AUBeAe OUhBoRM9HauQyDIauN7P46WxsCKPvr3KFTi/4wXKmwRabKlNI1DRkIECckLti/Mt8P t2+3IdJ/6uTGA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/9] mm/damon/core: make DAMOS uses nr_accesses_bp instead of nr_accesses Date: Sat, 16 Sep 2023 02:09:37 +0000 Message-Id: <20230916020945.47296-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230916020945.47296-1-sj@kernel.org> References: <20230916020945.47296-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,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 (snail.vger.email [0.0.0.0]); Fri, 15 Sep 2023 19:11:04 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777159119214202182 X-GMAIL-MSGID: 1777159119214202182 DAMON provides nr_accesses_bp, which becomes same to nr_accesses * 10000 for every aggregation interval, but updated every sampling interval with a reasonable accuracy. Since DAMON-based operation schemes are applied in every aggregation interval using nr_accesses, using nr_accesses_bp instead will make no difference to users. Meanwhile, it allows DAMOS to apply the schemes in a time interval that less than the aggregation interval. It could be useful and more flexible for some cases. Do it. Signed-off-by: SeongJae Park --- mm/damon/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index b15cf47d2d29..79fef5145a4b 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -770,12 +770,13 @@ static void damon_split_region_at(struct damon_target *t, static bool __damos_valid_target(struct damon_region *r, struct damos *s) { unsigned long sz; + unsigned int nr_accesses = r->nr_accesses_bp / 10000; sz = damon_sz_region(r); return s->pattern.min_sz_region <= sz && sz <= s->pattern.max_sz_region && - s->pattern.min_nr_accesses <= r->nr_accesses && - r->nr_accesses <= s->pattern.max_nr_accesses && + s->pattern.min_nr_accesses <= nr_accesses && + nr_accesses <= s->pattern.max_nr_accesses && s->pattern.min_age_region <= r->age && r->age <= s->pattern.max_age_region; }