Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5403459rwn; Mon, 12 Sep 2022 08:32:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5CaHHUjyWYlmPuWLpIQ7Qngq8w09IYgpc1X+DyUxvTNgMT0fmbG+fEz2tDwX7TSgL56QTN X-Received: by 2002:a17:902:e552:b0:16d:2a83:e751 with SMTP id n18-20020a170902e55200b0016d2a83e751mr26179280plf.39.1662996773092; Mon, 12 Sep 2022 08:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662996773; cv=none; d=google.com; s=arc-20160816; b=FFfQcTZejE5hEX2FslLGUOA6a8l7YL1mDBBsPqGIvplaeWTr1e7D5lwdJR5MKzZMpl lvvte8Wxo4SsleQvvXFi10iUYcPuw90UoZI8SBh4F7WZLYj9owFAlycoNjgrPxtpJNZd MLtAsJWL7wr/mmLU0kLVHfKYhFK4NycWndnmTxvKyexeQRH0mWFcBmmXGXoVFL+Tu41q XeCHF7jPAT2rz0ip7nwQnOv4f5sElopo1Vgrwk3TLDr2/ICzrhudAh47K3sqVykDZ0zi tbAGCUpo56hV1XYdJYzYMff9259zdM+Y1HwKdBMb0aN0ILRZSjYTgQGFcFEXkoko7V1A 7jaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=J2EfS61ET44TCc+3QSfNlPKs8G07uWPFuZhCKqF9mNg=; b=Ou0TaaXj7nUGwXJraYiWMSmav1h1VoQjhEqioGTU00JJUerUgvUU1JjX8yF7vUwbf9 1hGZw/4e4rSsYpGSYv5Os/E7OsIBuzb0QfrgBhWSZn6+TxWmC3r2u7EPFX7PhLNnI/lC MC2nv+dz4A4G+CgQI3zbATLvJUOBGHn1LTt1nFmTNBXdlRZx7hC3rWVDuebn6n4CAW1r S18NjUvyLd4AXF6J6SJ6+DqmlBU88ohNKFJWCCzi5LxMW3qYqHUWfEwIjK4sOKh+jnWp k07MoWwteKyybH81DAD6qDXUcHZdS9vjWj6ukjp51K3xxqSGYj34QzJi4KtyM7JCZCM2 77LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lvadD5K3; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a170902c40700b0016eddf64b6dsi11767741plk.181.2022.09.12.08.32.38; Mon, 12 Sep 2022 08:32:53 -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=@gmail.com header.s=20210112 header.b=lvadD5K3; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229886AbiILPMs (ORCPT + 99 others); Mon, 12 Sep 2022 11:12:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbiILPMp (ORCPT ); Mon, 12 Sep 2022 11:12:45 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 445882408C for ; Mon, 12 Sep 2022 08:12:45 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id t3so8905678ply.2 for ; Mon, 12 Sep 2022 08:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=J2EfS61ET44TCc+3QSfNlPKs8G07uWPFuZhCKqF9mNg=; b=lvadD5K3rHg41vyguPIZs3SAs0qNEImqL8auN87u0WS8Do2g67gHhkQT80c2u4gJxA RGJOtB8EtMOgz2k4rYvmUvKTGV/3ZnNJse0pcxuUIzu/N0bjKvNPvvyQrk8r6lBIM/Vc /BYK8ItrmRLwSa0fnHA5ys3gKpncm5G+gS1pLgs3lBe6c/qMWSFhc9HHeTqDt5crXB58 dMCmFTlzaspQrnhNv34zGiay22wWatvIt5YpeYR7QmL1bM9UD08RGB/0P0ZxQhU0SQB9 ht62eIr0wA4e+6jHqXf2Iz80usBeX4hXAurB18Zq4qrO8te4W6M3cFsXgDuoywwHSDvN h2Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=J2EfS61ET44TCc+3QSfNlPKs8G07uWPFuZhCKqF9mNg=; b=KdhT2tZdbWAt1NM2tBxWkcFBgWnSfiGEhryFCbLUGGNqeiq1gXhkd/Uj1Y5rq7L2XN hhxhN6gN6nK/47+SmGLjsmi0RNHsMN18H2VTN31I/Dtbk4Z//IHu2KaJoddynA9y7g6i GU7UNtXQxaGDkrlWteGWv+PZlyWKb4BBBvODTvoRVEgQYp3xa1dWzVgB9w3KrZHP3brF S3Hf5m70XcQm/gx3ZIlDzKD8Bxv73EZlCO6+4HSjF8+S2fWpLP1d0XeNb92+MSB9Xd4V +ouUUtHZBUFJk+929GPKVR4l7DqqR/erxMaBUVnUxhnXZWx136CzsmoLjmiUSqaDiBtd 19dA== X-Gm-Message-State: ACgBeo2t91u0Y64wB5so5kpqsrNYfl+M3WyKMIyIKKhEVrRR+3USmdWZ RyfyoGd/sB/MXhKBOZ7BoA== X-Received: by 2002:a17:902:e14c:b0:177:e7be:2ab6 with SMTP id d12-20020a170902e14c00b00177e7be2ab6mr23975827pla.25.1662995564687; Mon, 12 Sep 2022 08:12:44 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.3]) by smtp.gmail.com with ESMTPSA id u16-20020a17090a0c5000b00200b2894648sm5311046pje.52.2022.09.12.08.12.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Sep 2022 08:12:43 -0700 (PDT) From: xiakaixu1987@gmail.com X-Google-Original-From: kaixuxia@tencent.com To: sj@kernel.org, akpm@linux-foundation.org Cc: damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kaixu Xia Subject: [PATCH] mm/damon/sysfs: use the wrapper directly to check if the kdamond is running Date: Mon, 12 Sep 2022 23:11:53 +0800 Message-Id: <1662995513-24489-1-git-send-email-kaixuxia@tencent.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 From: Kaixu Xia We can use the 'damon_sysfs_kdamond_running()' wrapper directly to check if the kdamond is running in 'damon_sysfs_turn_damon_on()'. Signed-off-by: Kaixu Xia --- mm/damon/sysfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 7488e27c87c3..84861c4085a5 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -2455,8 +2455,7 @@ static int damon_sysfs_turn_damon_on(struct damon_sysfs_kdamond *kdamond) struct damon_ctx *ctx; int err; - if (kdamond->damon_ctx && - damon_sysfs_ctx_running(kdamond->damon_ctx)) + if (damon_sysfs_kdamond_running(kdamond)) return -EBUSY; if (damon_sysfs_cmd_request.kdamond == kdamond) return -EBUSY; -- 2.27.0