Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp975431rwn; Thu, 8 Sep 2022 11:21:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR68dmOl8EHIivzq/U6vnulxAwMMyPDQ1TzbG72lsgPN+cHAPoX/vU8DGmZlmvm9n70RunAS X-Received: by 2002:a63:451f:0:b0:42c:5a26:d7cc with SMTP id s31-20020a63451f000000b0042c5a26d7ccmr8927496pga.199.1662661284354; Thu, 08 Sep 2022 11:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662661284; cv=none; d=google.com; s=arc-20160816; b=OatIPR4tdSVvi3FUskcVhdTAPgiCDGkYCoL2Ty8+yBorBZjdW/jKIxhTKuA5LxU/w+ eDDsAcDBprhXu2HDrytiP+7ZpaiZP6FValuRm8xh/e+LhbU73ezjSaMzf7cslNc6lU/v oVyCM4ttgo0DQNIMCJ1EMJbfkt0oCrZ15KyHqYVwtoO5QZ4o/KiniZLpFiICLfh97Uxx W7AO1ZnsUy8pUa2i+//zIvA4o2xdfLK3bBLQ73blE9Cde9/oO9qoV4pethdpmMW0jzQj +ef94strtuicRGCqzMKxdeBsh3hk3kUtQZSm7ufjqVmNhOr2Awhgwsq92ic7nosLPAaD j46g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cmefy7b78YIG5emItUt9gXKKCOfJHfnHJruqTMR4XK4=; b=zvo+By/ppVd4NjL62UYmlR+uwI3aeYBs34YxFJxh/3Fs4JrDcGBEMeq/VxMTsoolOd uX/9vUDwskgItCYmK5OVRzqS/JIRUVpB6tRefkDrjdtS7U55i/wsIfWQkWpNo2Z4WZmO Lg/UYXoBQLGtkVpLypHoHRoFS6mr8m0kcxkPRjTScwX+3LmESqID4YqPHZoctFTanSS3 +OjTF9RbiL+vwl34YzbMyVwEHzMfiG7ea+jO5o1fAKy9oX6pcCwCeH2+HviZIL1NPqpI q5si9qUBn7JvHXKa4pGczeXvh2e1AdXuAldkcsjXKBCTLXsDjk3Fr5JHhFIE7EZkOCd8 cLew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N3ufNtX2; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a170902ce9200b001748ede4e05si22863072plg.119.2022.09.08.11.21.12; Thu, 08 Sep 2022 11:21:24 -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=@kernel.org header.s=k20201202 header.b=N3ufNtX2; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231447AbiIHSBX (ORCPT + 99 others); Thu, 8 Sep 2022 14:01:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbiIHSBW (ORCPT ); Thu, 8 Sep 2022 14:01:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43E15F10C8 for ; Thu, 8 Sep 2022 11:01:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 90884B821DC for ; Thu, 8 Sep 2022 18:01:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9ED4C433D6; Thu, 8 Sep 2022 18:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662660078; bh=Eyd2f05euQSrEzSKY+ufNZEqbz628QYuj+cOfZCVgsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N3ufNtX2TZLK5JUIePjDK/1DoHi233A3+qec1xZgYh2N7ixgnrTO4VcB4hnjvfFwj XV8+G/lxu0GdoLUSgUorkwnCUgQqdLOiJxRJz/NGKhA7td8zTjQOC7jgWTlHj+pJIw gyU/iwWIKsVY/uYiPEZSQ/JyJpu/YxNeS8m6RyOgRvj/u0sWBXdm9I4CeFg3aUJ+iO +V/nPDixo8kMEWsf6mEy2ag7d6SJKQxdVN9PpN29oOE5VHk1LCMtwa3Tu/Ypba4kZ6 BU7pOZe4oe1u9Rnn/ZlAFEs4FrpBKRk4aM3y4b7ixvteaIiKG3qhyyYYC1aU4ioySJ m1eYt6wAH+12Q== From: SeongJae Park To: Xin Hao Cc: sj@kernel.org, akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] mm/damon: simplify damon_ctx check in damon_sysfs_before_terminate Date: Thu, 8 Sep 2022 18:01:15 +0000 Message-Id: <20220908180116.33879-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220908021912.70481-1-xhao@linux.alibaba.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Just for a record. Apparently Andrew has already added this in mm: https://lore.kernel.org/mm-commits/20220907223146.C7CF4C433D6@smtp.kernel.org/ Thanks, SJ On Thu, 8 Sep 2022 10:19:12 +0800 Xin Hao wrote: > 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