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 B29D647DD50; Wed, 23 Sep 2026 10:15:14 +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=1790158536; cv=none; b=P4I2BP60gwviwskFcaEwCT4DeS4oNyXsyAhJ29etbI5Oqvv13fQgG4JYjyUIO1lU/95O36gfH6Sa6NCPeJ7RTs3bab67tihfuQ5SC7KvTMiiSVXjmBt9C0EkZkMVF7DS1X7d82EEEB+VGMLeDv0O1izv+zIAw9ErExAg/TX5aJE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790158536; c=relaxed/simple; bh=c79D70eyw1T2juEsK4YQjmcQoXzAL9pxRWlhbxUlMFA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mBeD/vkTE0A2rdfeLOQFMMsK48EDNH3RLuMGcOI1jVPqH4nitCfSY1m3jiRydvuH2rwV9PrneqZP+70B/x6BylEIw82o/Cvk67WI8kVKSNN6kZFWmi9SKLVM6lNW+7FY1KteHGKje7bXmgnClIhPOarAhzuY4JnIZlgG/kEuaBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ezQ/1aZF; 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="ezQ/1aZF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2B861F00899; Wed, 23 Sep 2026 10:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790158508; bh=Vdshcv/mUOg+wTQtdfCd8vXc9tZN4VpaqOf6VvBPPR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ezQ/1aZFalTx1tc4WE5blL0sFdIGueOVa2fVvXYtcl4tnQjsZpVE6/3DZmYKpS2j2 AlOsmVC0ztXMRHfdOqVCQ8wFy0oPhA5HjanbrKDHGLeFksOIhhjkMMYORRYruvDDr/ W5jQERYzL4cgj7JwdZHzJZH3ClcEkANRBYkgLxJQdDqJCE6s8WlDLeQIefj1PKvNdl 2xH1mhb8R9SBg/8JMX0nQlKK7xxkvVeEYg7eyi8Rol1rAgGmwXcj7X+3td7qmPefuI 2yr1fbxck3+wxbv4y4bWR2lP0BI7N521e8EIOPO1qmBHEgJ7RftGcOigq+Q0nKW+Ik O2lWBP2mnZiyA== 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 v3 3/7] mm/damon/sysfs-schemes: support quota goal complement flag Date: Wed, 23 Sep 2026 03:14:48 -0700 Message-ID: <20260923101454.5748-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260923101454.5748-1-sj@kernel.org> References: <20260923101454.5748-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 06af417bc9a2..8f083611741f 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