Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp36529rwn; Wed, 7 Sep 2022 19:27:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR4NfHwlaq4jipSzhCLZV9tfct2K1ILQGli2p9BA47m2sYhPv+KMuxeOR8HIww4JFsPyFbbh X-Received: by 2002:aa7:dbc7:0:b0:450:c05d:1afc with SMTP id v7-20020aa7dbc7000000b00450c05d1afcmr280330edt.262.1662604078482; Wed, 07 Sep 2022 19:27:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662604078; cv=none; d=google.com; s=arc-20160816; b=iumlFjKa1HcGdh5huBOy15DGBwpk924y0iS8n/kK3KyLB9QL++2AeglYn58XDPLkXa h3quCmcdoPNVSsnr0RfpkTkaAKENJcnq28EyGJrsgUUYMEE3NADwwi840zL+6qmkAqec lqLFXoOCys88aClmzv45SLz4Nylpe54frlyQ/pOgkhxenMPYO6VXZyxt9ZWCH37pzBbB bCEqOXKAoIepwXLX3NrYn9Bt7vY3nsoXuRpWhVz1u5zE17B7lji7h9pWVUa8hf7LvRNA WJLuo8o7IyxfTjk4tBXCitvGDsE3mFLniVcPWxcLQTdO9Am6J3368bi3eZVNJvMoa2UV WmJQ== 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 :message-id:date:subject:cc:to:from; bh=ODEXecGcX57GQLGC6aEWoiPEw8QVquCGqoNg4ikV3R0=; b=RL7K/D8Sf1iGVmEXiWP0QaS6OVD0tQZ5uvzegAQI8Ikr7IrZw4wDaEMCAsKaFccwnd k8rchmqLePej0gogewnWlcyhX5F68OETRQx/WD/oHG1hGfXkeVxtgS9lPJ0dImZRrOlp ZInb6cD/GUZxikyvVRi4wpq5RLoNfY1S8N033oEcaxzuBgXv+42c9yt1IYJXKDZq+B4I Td5gM9A0wEuGJBEN/vxTo3AsQhbtj4RsVvc5fT9Ztou7GapOj1NUJwn+YNsQd9ArCKFR FQRrh9yrzfK/LT5bMAsHk3WpPkaeRpFiEif5BfWvF3C97IzgIEeTGD1DQ2iAjQXM+uDZ ymsQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a170906c30300b0073c194e99f6si859350ejz.779.2022.09.07.19.27.33; Wed, 07 Sep 2022 19:27:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229979AbiIHCTW (ORCPT + 99 others); Wed, 7 Sep 2022 22:19:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbiIHCTU (ORCPT ); Wed, 7 Sep 2022 22:19:20 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0A2BCEF for ; Wed, 7 Sep 2022 19:19:18 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R741e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xhao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VP0-.tt_1662603554; Received: from localhost.localdomain(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0VP0-.tt_1662603554) by smtp.aliyun-inc.com; Thu, 08 Sep 2022 10:19:16 +0800 From: Xin Hao To: sj@kernel.org Cc: akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, xhao@linux.alibaba.com Subject: [PATCH V2] mm/damon: simplify damon_ctx check in damon_sysfs_before_terminate Date: Thu, 8 Sep 2022 10:19:12 +0800 Message-Id: <20220908021912.70481-1-xhao@linux.alibaba.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 In damon_sysfs_before_terminate() func, it need to check whether ctx->ops.id supports 'DAMON_OPS_VADDR' or 'DAMON_OPS_FVADDR', there we can use damon_target_has_pid() instead. Signed-off-by: Xin Hao Reviewed-by: SeongJae Park --- mm/damon/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 7488e27c87c3..88f208ff235d 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -2309,7 +2309,7 @@ static void damon_sysfs_before_terminate(struct damon_ctx *ctx) { struct damon_target *t, *next; - if (ctx->ops.id != DAMON_OPS_VADDR && ctx->ops.id != DAMON_OPS_FVADDR) + if (!damon_target_has_pid(ctx)) return; mutex_lock(&ctx->kdamond_lock); -- 2.31.0