From nobody Fri Apr 3 03:48:52 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC1B2ECAAD8 for ; Fri, 16 Sep 2022 13:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231704AbiIPNfw (ORCPT ); Fri, 16 Sep 2022 09:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231698AbiIPNfp (ORCPT ); Fri, 16 Sep 2022 09:35:45 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53AFC5A175 for ; Fri, 16 Sep 2022 06:35:44 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=xhao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VPxa0sf_1663335339; Received: from localhost.localdomain(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0VPxa0sf_1663335339) by smtp.aliyun-inc.com; Fri, 16 Sep 2022 21:35:40 +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/sysfs: more simplified code calls damon_target_has_pid() Date: Fri, 16 Sep 2022 21:35:35 +0800 Message-Id: <20220916133535.7428-1-xhao@linux.alibaba.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch further simplifies the damon_target_has_pid() call and makes the damon_sysfs_destroy_targets() look cleaner. Fixes: 49fb890735ab (mm/damon/sysfs: avoid call damon_target_has_pid() repe= atedly) Signed-off-by: Xin Hao Suggested-by: SeongJae Park Reviewed-by: SeongJae Park --- mm/damon/sysfs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index dc8dd56d6589..7692c706bcc5 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -2132,10 +2132,7 @@ static int damon_sysfs_set_attrs(struct damon_ctx *c= tx, static void damon_sysfs_destroy_targets(struct damon_ctx *ctx) { struct damon_target *t, *next; - bool has_pid =3D false; - - if (damon_target_has_pid(ctx)) - has_pid =3D true; + bool has_pid =3D damon_target_has_pid(ctx); =20 damon_for_each_target_safe(t, next, ctx) { if (has_pid) --=20 2.31.0