From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B62BE37E5DC; Sat, 19 Sep 2026 01:14:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789780454; cv=none; b=fZDVzv0+Fkmwja9CUCFgTr223LqxFNyL68PmYQBbTUasq2QYVZ+pO5q+AYFY9zByUFZ7p0LmgnG7iyupm1oCJ3FT8ipuCYcCBGUz6A9SUw8kFdKusF1ovj3+zMLTNuKnaKDMW3LP8ST2ixE7xmvH7sO0/FluyFvXwo7PNg8PFF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789780454; c=relaxed/simple; bh=HjBlbB9cQ9AY2BIG0hpY09SGHxT1AW2xqARHgHIt4H8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SbWcDJRXHGw5OV6Cwj4t+ilGTqoEHOfLU4Dw7EL4FgJ6dc3gkCjpNoMZxELqnntCCZBgTTy4D31s8sPsJfu3Jrzq5PYCMMgWISytrinek9w+1f9EWoNeS6ZCa6riW/skjBFr546xLGoxdqRPebHYiTL073nKlw9eJoPFQsltTYA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m1PGPwZE; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m1PGPwZE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D451F1F00899; Sat, 19 Sep 2026 01:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789780449; bh=mdugPBiHc8ArlRBJbW3eu//HjQmVTaFB93kqP3fmOG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=m1PGPwZEpabQVLOrfZZd3ej07IScuWuGfXtuYHxYWPlsNF3z869jz4W4qtpuUQIsQ 5iGCfCYCn+2sQh5aMVJDThYTZODMNFrfueep8QO8ICFhlhEdmHUqfWOsHzuSNKPNL5 OpkWNUenuEdsReDoGbN0m6sqXNzALZ/c/7IBO4AOh4kbaJd86z+b7LhE0NymKHTDHK CfuJS39ia67mzBbf7q8uCXGB14l0RHvTWZQYBXMlFfAmsXoAJnPE97A4NJOlgCil2A LVQ2Im4GmNYIaKI7KD92/R3lSYZYio+Yx534nm72kXHDoSYcLz4SUOO14evjxd6CEY BrQiRVy58YoiQ== From: SJ Park To: Cc: SJ Park , Andrew Morton , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 3/7] mm/damon/sysfs-schemes: support quota goal complement flag Date: Fri, 18 Sep 2026 18:13:52 -0700 Message-ID: <20260919011359.88921-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260919011359.88921-1-sj@kernel.org> References: <20260919011359.88921-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a new sysfs file, complement, under the quota goal directory. It works for setting and getting the quota goal metric complement flag value. Signed-off-by: SJ Park --- mm/damon/sysfs-schemes.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 06af417bc9a2f..8f083611741fd 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1220,6 +1220,7 @@ static const struct kobj_type damon_sysfs_watermarks_ktype = { struct damos_sysfs_quota_goal { struct kobject kobj; enum damos_quota_goal_metric metric; + bool complement; unsigned long target_value; unsigned long current_value; int nid; @@ -1316,6 +1317,30 @@ static ssize_t target_metric_store(struct kobject *kobj, return -EINVAL; } +static ssize_t complement_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damos_sysfs_quota_goal *goal = container_of(kobj, + struct damos_sysfs_quota_goal, kobj); + + return sysfs_emit(buf, "%c\n", goal->complement ? 'Y' : 'N'); +} + +static ssize_t complement_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + struct damos_sysfs_quota_goal *goal = container_of(kobj, + struct damos_sysfs_quota_goal, kobj); + bool complement; + int err = kstrtobool(buf, &complement); + + if (err) + return err; + + goal->complement = complement; + return count; +} + static ssize_t target_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -1424,6 +1449,9 @@ static void damos_sysfs_quota_goal_release(struct kobject *kobj) static struct kobj_attribute damos_sysfs_quota_goal_target_metric_attr = __ATTR_RW_MODE(target_metric, 0600); +static struct kobj_attribute damos_sysfs_quota_goal_complement_attr = + __ATTR_RW_MODE(complement, 0600); + static struct kobj_attribute damos_sysfs_quota_goal_target_value_attr = __ATTR_RW_MODE(target_value, 0600); @@ -1438,6 +1466,7 @@ static struct kobj_attribute damos_sysfs_quota_goal_path_attr = static struct attribute *damos_sysfs_quota_goal_attrs[] = { &damos_sysfs_quota_goal_target_metric_attr.attr, + &damos_sysfs_quota_goal_complement_attr.attr, &damos_sysfs_quota_goal_target_value_attr.attr, &damos_sysfs_quota_goal_current_value_attr.attr, &damos_sysfs_quota_goal_nid_attr.attr, @@ -2869,7 +2898,8 @@ static int damos_sysfs_add_quota_score( if (!sysfs_goal->target_value) continue; - goal = damos_new_quota_goal(sysfs_goal->metric, false, + goal = damos_new_quota_goal(sysfs_goal->metric, + sysfs_goal->complement, sysfs_goal->target_value); if (!goal) return -ENOMEM; -- 2.47.3