From patchwork Thu Sep 8 02:19:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: haoxin X-Patchwork-Id: 12969576 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 1214DECAAD3 for ; Thu, 8 Sep 2022 02:19:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F3C06B0073; Wed, 7 Sep 2022 22:19:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A2CE6B0074; Wed, 7 Sep 2022 22:19:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 86AED6B0075; Wed, 7 Sep 2022 22:19:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 773736B0073 for ; Wed, 7 Sep 2022 22:19:20 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5108E14124A for ; Thu, 8 Sep 2022 02:19:20 +0000 (UTC) X-FDA: 79887311280.26.4F5545D Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by imf27.hostedemail.com (Postfix) with ESMTP id 559C6400BF for ; Thu, 8 Sep 2022 02:19:18 +0000 (UTC) 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662603559; a=rsa-sha256; cv=none; b=jTDG8NW1aTi9aWaZeiXq8xaXFNDsZE3UuauEDwhChLAvWf19EhFY5lVMUrU0/5YkZMdpA+ hcXOhxi0uEJf9ZvulXi30EP1v/6A8J04nFaP7FcgZilmySkxbGWz9xfw4lvdyYm/tQ8wdf vWSiQp4Wxz6OU6ugKHhWfDxnSNVqdSg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of xhao@linux.alibaba.com designates 115.124.30.56 as permitted sender) smtp.mailfrom=xhao@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662603559; 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=ODEXecGcX57GQLGC6aEWoiPEw8QVquCGqoNg4ikV3R0=; b=phEKTpGAsdbF9MjlgIOFegogE2ImYbhPIQl51wo2pdPSbhpPyBit3f/Be0VJDjsM732oLM eQSKa2aE1hwhC3bUvn1lXT/j9vZEkeHuaKrMZ8WZxGVvgfkH52LOnaMugNTo54Z2pqOz8N KzxKiaSqZW9nn2jw6+cAuAGacD1drWQ= X-Stat-Signature: bwh39bruk9qbc1o4gpqomuxqmghdw1b8 X-Rspamd-Queue-Id: 559C6400BF X-Rspamd-Server: rspam11 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of xhao@linux.alibaba.com designates 115.124.30.56 as permitted sender) smtp.mailfrom=xhao@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com X-HE-Tag: 1662603558-17454 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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(-) -- 2.31.0 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);