From patchwork Wed Sep 7 08:41:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: haoxin X-Patchwork-Id: 12968639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAF88C54EE9 for ; Wed, 7 Sep 2022 08:41:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1AE826B0073; Wed, 7 Sep 2022 04:41:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 160368D0002; Wed, 7 Sep 2022 04:41:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04D5A6B0075; Wed, 7 Sep 2022 04:41:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E68246B0073 for ; Wed, 7 Sep 2022 04:41:28 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B9260AB737 for ; Wed, 7 Sep 2022 08:41:28 +0000 (UTC) X-FDA: 79884645456.24.543F75E Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by imf26.hostedemail.com (Postfix) with ESMTP id 1227214009B for ; Wed, 7 Sep 2022 08:41:26 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R901e4;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_---0VOxRMkY_1662540081; Received: from localhost.localdomain(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0VOxRMkY_1662540081) by smtp.aliyun-inc.com; Wed, 07 Sep 2022 16:41:23 +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] mm/damon: Simply damon_ctx check in damon_sysfs_before_terminate Date: Wed, 7 Sep 2022 16:41:16 +0800 Message-Id: <20220907084116.62053-1-xhao@linux.alibaba.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662540088; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=xHdJB+sVlY2abyb+q9sMQIIQ73T9PIWKnbZXtjYkswE=; b=N3GXGm1Jy0sffpVzactXv0XnGXVE623pfyB+Z4chGztXK3Vskm2d84Jqx4neXiddlJ9mde d3eNZnwSH51sIHz+D/Xl+NuBHuz1v2ZrcXE1ucpmqALM9J5NoTM/Yd1ZtWWX3EFSDIKgsc R9e+UKBW7z59aQbOaWSDbcaIXe/M9Wk= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of xhao@linux.alibaba.com designates 115.124.30.54 as permitted sender) smtp.mailfrom=xhao@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662540088; a=rsa-sha256; cv=none; b=OAWbBqrw43u3f8tOgHMU8t1XvfTcxBLvFcLpH04/iJrKTjJz+XciWnH3P0u0geI4vGn89C 5pQZQIqG3vYQ8asZQ+qIBvCf6XL8/ORhwrjS7upB7h5Xhilx6+wYhaMbvdyeGIvoIcVRat 9BFc6tJL6VfMxofM84YgzrHurA6bcDY= X-Stat-Signature: nkhczsjeour46jbwzayo5ejd9nhqjhjp X-Rspamd-Queue-Id: 1227214009B X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of xhao@linux.alibaba.com designates 115.124.30.54 as permitted sender) smtp.mailfrom=xhao@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com X-Rspamd-Server: rspam09 X-HE-Tag: 1662540086-489281 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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);