Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp13844742rwb; Sun, 27 Nov 2022 12:29:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf47Fy1uE/spwK/RvX20LZQy2/OFQal/EnSkH9b8m15N487FVw/t4YaQLfVmoBHSuuLNV+cK X-Received: by 2002:a17:906:c30c:b0:7ba:1f48:ccec with SMTP id s12-20020a170906c30c00b007ba1f48ccecmr19016121ejz.105.1669580949066; Sun, 27 Nov 2022 12:29:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669580949; cv=none; d=google.com; s=arc-20160816; b=DUtVwt9g76/2h+9l9KhyW8+AjR95lfM0YJfRFHAficToEP8oFvuGyUaHbpEoQ8KGEY xaeTc7mJBjxRH7keYc+QMiPqi3eQLGKAW3PGebRL9bRbV+kl2mLXoKQpm5E+VJLOvEPE YMS6gA7pCMdUTnUaQjzABxlF6J1wxGRQvDe5au4mmEi0XT+wibfmTwc0iQEI+YYyZ7wU 06155zbSxs8ruEeKDFeeKvfQsbOq9SYzrt4ZrNQTO8a/OFiC0RsOtyJ9fqDwz0ZWhaeG UbquMe2aYQMoZmEVdKV0GZByXjr/w4IqMwQe4g3PxDeyxxwBO+ZiJUcfrGTzJMUzUkzx eBug== 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=hgW0sTCHyikug6PslUbZmqH7KGlaqHaoc7OBL6fE2pI=; b=Pv3/vMj9nyEvUjJa7emkVxqxgPX8qYxKS5OgWSbnXtr06UeaChqzRBaHd0mbAg6bin 0K7CWI/R0OYD5yu21O+b+QXQ3Wh8sFfJ034BzrGTkxMSv6cyGn0a/3Pph2xoRL4TokYO UJ9zLdoxCw/1Yzw43/xRvgRrNq2Vuj5/eY6UYW1UFxKVuTyk9O9xLX7XMZZtPUs1S4pw kzOmnYUfQnT3GIXm+FV26bnJjunSWihf66tNSm7OGzSltdnRTLP6PRpYKUmcVmiyIaow x915G7MZYwhV03Pj7MhNNdV3PdcQNm4CnAxN/ylvS3yd0lwhctRr3VTb3c6Wx6T+rZ8J asYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="V/sSpxdQ"; 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 dm21-20020a170907949500b0078dc5b2b6c4si9258335ejc.666.2022.11.27.12.28.46; Sun, 27 Nov 2022 12:29:09 -0800 (PST) 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="V/sSpxdQ"; 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 S229543AbiK0Tv1 (ORCPT + 85 others); Sun, 27 Nov 2022 14:51:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiK0TvZ (ORCPT ); Sun, 27 Nov 2022 14:51:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A3B264DC for ; Sun, 27 Nov 2022 11:51:25 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id A070260DF7 for ; Sun, 27 Nov 2022 19:51:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94E75C433C1; Sun, 27 Nov 2022 19:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669578684; bh=u/x3fW/kNN7k6/MnlQGpUtV7XW5nRo+M7USr9HpvEd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/sSpxdQIfJtGqzzYHBMhwtme35L2XQD2y8x0d09iM4lJd02TwbLUXuVYwZU2PVsX 6GBmJRvWvNfptTxdRvE9Jq+A61+fd11sDKZv8//W1XkfNv6BazyTHSJfgsDYGnSm77 qsbyvE4EpBBsuJDzRekoyBy78EKhcEuCfrvn7RPVMhpemRRk1EWYM2aZFMyz0vXYs0 GIu3fvGDbLa+RVv1GS/uEkALoV+HGfW49Ky4038A0mhZPX3b2u5u9JQLRo0aEFCiYz tHcTqwR5mCXPD7fK2b5FvzyHcWa9ZpVm7dFXva5q3DLdZS15wyaBJzKjH2i7kNiGYB upDa8qTGeo0Nw== From: SeongJae Park To: SeongJae Park Cc: Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 08/11] mm/damon/sysfs-schemes: implement scheme filters Date: Sun, 27 Nov 2022 19:51:21 +0000 Message-Id: <20221127195121.1388-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221124212114.136863-9-sj@kernel.org> 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 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 On Thu, 24 Nov 2022 21:21:11 +0000 SeongJae Park wrote: > Implement scheme filters functionality of DAMON sysfs interface by > making the code reads the values of files under the filter directories > and pass that to DAMON using DAMON kernel API. > > Signed-off-by: SeongJae Park > --- > mm/damon/sysfs-schemes.c | 85 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 84 insertions(+), 1 deletion(-) > > diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c > index 7f2bab617156..6f014b328e6f 100644 > --- a/mm/damon/sysfs-schemes.c > +++ b/mm/damon/sysfs-schemes.c [...] > +static int damon_sysfs_set_scheme_filters(struct damos *scheme, > + struct damon_sysfs_scheme_filters *sysfs_filters) > +{ > + int i; > + struct damos_filter *filter, *next; > + > + damos_for_each_filter_safe(filter, next, scheme) > + damos_destroy_filter(filter); > + > + for (i = 0; i < sysfs_filters->nr; i++) { > + struct damon_sysfs_scheme_filter *sysfs_filter = > + sysfs_filters->filters_arr[i]; > + struct damos_filter *filter = > + damos_new_filter(sysfs_filter->type, > + sysfs_filter->matching); > + int err; > + > + if (!filter) > + return -ENOMEM; > + if (filter->type == DAMOS_FILTER_TYPE_MEMCG) { > + err = damon_sysfs_memcg_path_to_id( > + sysfs_filter->memcg_path, > + &filter->memcg_id); > + if (err) > + return err; > + } Newly created filter should be added to the scheme, but this patch is missing the code. Will add that in the next version of this patch. > + } > + return 0; > +} > +