Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp17614pxb; Wed, 30 Mar 2022 21:36:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk7j4PoUt0AyS33Rukf+X/yh/Meqjd02YOarzef59JxxukZCPwedofSwLTsw8ZawHc2WHj X-Received: by 2002:a63:7258:0:b0:398:7298:c4b6 with SMTP id c24-20020a637258000000b003987298c4b6mr5477948pgn.436.1648701406161; Wed, 30 Mar 2022 21:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648701406; cv=none; d=google.com; s=arc-20160816; b=vkN2EV5u6gqYssE1tGzY/ALLP4CwzXWEI1Ls9Tz/lXLg2ROb94fEjhDseeaIs67WK6 oVxAyuxguuB2JBfmnY9LLypkZLtw8DqfVEMVEFvC2T3z/XZkSRicHkOhvCsAG1f8tRE8 qOiPCCnKrMAcy3z8xUDmL67E2BtBKbQfFXZBZOBONJKPE/iX4gV6GQwSnxI/ONy8B0e7 A59VGdcIIIb+TNt0uO2+rHWEGVrE8H4U3kd3f9bvuOcWecEbpETt7OF2YfCqwZSRJOfW 7G2j2I2NiYgMs3O5ZFN/81HRU7zi060z5CMJrVLVuM2/2QvemtqhCbZS7WFhqpfwtp8M 2hBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bgVW/lN/qYaiZq62Ek8FP9kK5TU4lb1i16pWhC45zSo=; b=PBSPMEDbJpqgRPO4ha1qYcw5jVWRCkT9gMtDlxpI2jMVy38L02mGhdAnyRI0yuHTOy QnEb8rQ+EIVUZRKgnSC9m24f/ZcXFthuhwECCSxx7DYz9SnHPsJnbBihyVDj3lPcq9uL lkV5GbjAyKW5vVDqy8dpU1IK/Ywqhmy6GQTbJ7mpPshHFrhvRXjmkut+bfjeNliroeHJ Yvc9FnEMwXtoV+DZ2ckzUgdxk5cY2+kkZXtJPWIrS/vUymT/MTW2q00Xh2jyO122u7dy fhIzZsuz7ZCRrJ/zijynZMhq+83AFMIBXrwgF7PIe3v+SA2EGWUbFNWuX1oh1F3eMZ13 cT6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jl094bri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id rm2-20020a17090b3ec200b001bd14e03066si2247038pjb.62.2022.03.30.21.36.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 21:36:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jl094bri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 432C11FF41D; Wed, 30 Mar 2022 20:29:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241615AbiC3MTi (ORCPT + 99 others); Wed, 30 Mar 2022 08:19:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344293AbiC3MAd (ORCPT ); Wed, 30 Mar 2022 08:00:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F4F9340E9 for ; Wed, 30 Mar 2022 04:55:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ADCC8B81C25 for ; Wed, 30 Mar 2022 11:55:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF547C340EE; Wed, 30 Mar 2022 11:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648641319; bh=1HPyfRo5DHhp9R70XYYumzCEapXTyvDbHoQuEdQvgE8=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=Jl094britH6ONTd25NFMz9UnjM6d2m3/9NnfHo46z3Um8fGDWUcOui/GLBWC38RRA xdE6zLhqI6xQgQ2ZJgjbF3yoRsb7ht61yQaMVgXHfKp79I2dGR8JnZa2KUY3DGVHC7 Jp+gUYYD3n/3EEpx7/3BztsEaTT5caTyvoW60YurT+x3gYc1bV50tKoekAHRvDxLx2 Qn/ugnd6Z2FxOrF8T8+ZfHbQfAofOwn9qYza0QbhfeHznqAkPiVuHV+xUctk/M9Xno UAkVENvrobHHp5JLTjRooFbFs2hb1AtvPzz18PhHorKwvs8Ql9qGbEFbJLp7tJEwa0 Kg4JC23/KGPhQ== From: sj@kernel.org To: Jonghyeon Kim Cc: SeongJae Park , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/damon: prevent activated scheme from sleeping by deactivated schemes Date: Wed, 30 Mar 2022 11:55:16 +0000 Message-Id: <20220330115516.32126-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220330105302.32114-1-tome01@ajou.ac.kr> X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hi Jonghyeon, On Wed, 30 Mar 2022 19:53:02 +0900 Jonghyeon Kim wrote: > In the DAMON, the minimum wait time of the schemes decides whether the > kernel wakes up 'kdamon_fn()'. But since the minimum wait time is > initialized to zero, there are corner cases against the original objective. > > For example, if we have several schemes for one target, and if the wait > time of the first scheme is zero, the minimum wait time will set zero, > which means 'kdamond_fn()' should wake up to apply this scheme. However, > in the following scheme, wait time can be set to non-zero. Thus, the > mininum wait time will be set to non-zero, which can cause sleeping this > interval for 'kdamon_fn()' due to one deactivated last scheme. Good catch, thanks! > > This commit prevents making DAMON monitoring inactive state due to other > deactivated schemes. > > Signed-off-by: Jonghyeon Kim Reviewed-by: SeongJae Park Thanks, SJ > --- > mm/damon/core.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/mm/damon/core.c b/mm/damon/core.c > index c1e0fed4e877..5ce8d7c867f0 100644 > --- a/mm/damon/core.c > +++ b/mm/damon/core.c > @@ -1019,12 +1019,15 @@ static int kdamond_wait_activation(struct damon_ctx *ctx) > struct damos *s; > unsigned long wait_time; > unsigned long min_wait_time = 0; > + bool init_wait_time = false; > > while (!kdamond_need_stop(ctx)) { > damon_for_each_scheme(s, ctx) { > wait_time = damos_wmark_wait_us(s); > - if (!min_wait_time || wait_time < min_wait_time) > + if (!init_wait_time || wait_time < min_wait_time) { > + init_wait_time = true; > min_wait_time = wait_time; > + } > } > if (!min_wait_time) > return 0; > -- > 2.17.1 >