Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp960993iof; Mon, 6 Jun 2022 16:47:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTni/GWlWWP1bd0OIy4NZevapltTIsvTgjfTTIzc95Z6DJwGxlf+vtURrpuLE73PHcDLK+ X-Received: by 2002:a05:6402:1e92:b0:42d:dc34:e233 with SMTP id f18-20020a0564021e9200b0042ddc34e233mr30366915edf.386.1654559229255; Mon, 06 Jun 2022 16:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654559229; cv=none; d=google.com; s=arc-20160816; b=aNpGDr4eg4aGVNN5XgQmACoQ8GTx4G3cxijujcos4588Fxbybjovf2x7tTCufoDglk BQqSDH5xdvwAKESjEe5j+MjI6oEvCod9Qyw8Ztc59TpHixxRdMByzwYbaz6gQFVqfrwS RFe29KGe0by7lZgvPNA062yl5zz9XFQSUe9Bw8jNscc99a6GRf9Ogt8zB3sF+6GxMh7U B/wnTwQKbtDugK8Fktjskp+1rykGnbYJXTNdBTAMqduEwMTPMpavF60ymrDgXz/h+sJG UruZqXR+D/DkS9P8k3NoVf+n8oi/O5Hi5pBH8UsSL2bojYECNCni9a/KTq+qlZAng7vr +sAQ== 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=WWVu/kpGWFtUoTnBq8AzBxsOmGxmaFZ45phgxWpJemw=; b=yjiYfSWo3t9aDnICxvlVMOFrLTkEtFXQlhDTeOd0+w0PgAIHAP8MGO780cF2yFVOhj x7Bwz5au9sunCaDXzjLLPdJx/2tzrTY0U0oISphhuqinj1Wa4PdaC7cbwhOUVUouNBQM tWb9GU8rYEwrjIjMVKv66i3dGH0u63XCPJb4vyujO4iSEvv7wIgMMmOWInyT7pECWtDe ozKnexs6RdmMLLBfjvFdPao6GY6R7DKcHHRYQ3NWoBtYIbDBsNSjnco4qKz6IPsQgCXD q2io/gQnQguArrCTvQ8zCAgLwgToQqPKXClA2NL+6wXt3fz8dJbfqrLUw/6KPcFHkxAs AxwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cxG50trj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020aa7d484000000b0042dd274260csi15343070edr.634.2022.06.06.16.46.43; Mon, 06 Jun 2022 16:47:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cxG50trj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231699AbiFFSXn (ORCPT + 99 others); Mon, 6 Jun 2022 14:23:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231592AbiFFSXY (ORCPT ); Mon, 6 Jun 2022 14:23:24 -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 D5D8910655B; Mon, 6 Jun 2022 11:23:22 -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 8E35AB81AF1; Mon, 6 Jun 2022 18:23:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C751BC385A9; Mon, 6 Jun 2022 18:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654539800; bh=zzYotTKEGLDprg9+poMHiWB57TXnLs8veIXqbVZJakQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cxG50trjbZk11hd8BkFPwMnPsdUMaKaDxA2TDSM1UP6LsoVQ2+0tCUFnSFT9JTdgi /Lfe0F+d4rorgHfn5Dn1QZm0yd2Of6JsN4IBr2lSKmC05oOsOFOKb9RXwNYBUX3sNz jccl9HwJ5MX8yhA+qInAi3jwKf9gVkYG0SB5R4cJOQfzGvXYDNq+kEXV8PuK5rGnre 7Ne08FyMzxIoQvddB01DsviJGOfNDDCKiqalHx8+QnvFVUzsqzqilvFWYw0I9e+WGj 7YZe6OK5GXKeiLIZqpS5L2VACnDfO3ic+5RciciQeU/GEi2W+xdaXzBT3/cNwJtX2C tbYobf3tbGxGQ== From: SeongJae Park To: akpm@linux-foundation.org Cc: corbet@lwn.net, damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 5/6] mm/damon/reclaim: make 'enabled' checking timer simpler Date: Mon, 6 Jun 2022 18:23:09 +0000 Message-Id: <20220606182310.48781-6-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606182310.48781-1-sj@kernel.org> References: <20220606182310.48781-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 DAMON_RECLAIM's 'enabled' parameter store callback ('enabled_store()') schedules the parameter check timer ('damon_reclaim_timer') if the parameter is set as 'Y'. Then, the timer schedules itself to check if user has set the parameter as 'N'. It's unnecessarily complex. This commit makes it simpler by making the parameter store callback to schedule the timer regardless of the parameter value and disabling the timer's self scheduling. Signed-off-by: SeongJae Park --- mm/damon/reclaim.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c index c2ed962db23f..38da28803d75 100644 --- a/mm/damon/reclaim.c +++ b/mm/damon/reclaim.c @@ -353,7 +353,6 @@ static int damon_reclaim_turn(bool on) return 0; } -#define ENABLE_CHECK_INTERVAL_MS 1000 static struct delayed_work damon_reclaim_timer; static void damon_reclaim_timer_fn(struct work_struct *work) { @@ -367,10 +366,6 @@ static void damon_reclaim_timer_fn(struct work_struct *work) else enabled = last_enabled; } - - if (enabled) - schedule_delayed_work(&damon_reclaim_timer, - msecs_to_jiffies(ENABLE_CHECK_INTERVAL_MS)); } static DECLARE_DELAYED_WORK(damon_reclaim_timer, damon_reclaim_timer_fn); @@ -388,9 +383,7 @@ static int enabled_store(const char *val, if (!damon_reclaim_initialized) return rc; - if (enabled) - schedule_delayed_work(&damon_reclaim_timer, 0); - + schedule_delayed_work(&damon_reclaim_timer, 0); return 0; } -- 2.25.1