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 C01EF3B1ED0; Fri, 18 Sep 2026 14:28:36 +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=1789741718; cv=none; b=fWz4asnZtlTITiylF06XhIHw3/SuTwDhUUyxWTQRL6waBnm1CBtDdF47HlOwCjoB8mlA2oGUxTaeWCM+LRhmjpfGC9aCwTAggdcB99wfXsPDkpfiXQ7NlxPZ5D+rvDQSmcZI+QXhFdDO7BV5OI608Lxr/dUyHh3IHvhIz3UGGYs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789741718; c=relaxed/simple; bh=HjBlbB9cQ9AY2BIG0hpY09SGHxT1AW2xqARHgHIt4H8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LsW0ZohXiWvcIzZq0UAuMPkxMZ8536Q5V97JyyA188/TVGWYs/HdaZYiqNWffDvI/DRrOOLjOKAJ4kmNksC/HmXa/2ek+fjB0IppRQzyBKxCmdN0JT8EOQHds72Oq0Qk2vXgrflTVfQEqecuMB5lV8wR1F4x1nUyj1x1ZXfVuuI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CcmwbUsz; 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="CcmwbUsz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69D3C1F0089B; Fri, 18 Sep 2026 14:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789741716; bh=mdugPBiHc8ArlRBJbW3eu//HjQmVTaFB93kqP3fmOG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CcmwbUszFWpBfQa1iQ2t21vlxzKgrEOnkDWYeuu/C2mXRSzEFyAUbBViytuXt+N83 mcvTXeJnZ0S4vTwLZ94shlAVPFgKS8Tgbsv1c7/O40ixcxwZ+H3yVPh3jBlitnMSOi kavYPgIxBPBFBZg35FJCGj8W0ze0edZx2+tRS2wi03cPhu2fQw/CK4uz6YxFkYTDfV xH3hcJ+EnjQd2jbsvJhoAUTue8m/YSb4Ve7yAhrulsaJJaLbOAvSgHWWgTrUsmJ4HS NmR/BcidKZnpmR7XKZ6JkP8nnTnELMjKdwzwtaSXhj84MSNtK7ZENSM0HFfavTv/mC huZj73M295NDQ== 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 3/7] mm/damon/sysfs-schemes: support quota goal complement flag Date: Fri, 18 Sep 2026 07:28:22 -0700 Message-ID: <20260918142827.85303-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260918142827.85303-1-sj@kernel.org> References: <20260918142827.85303-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