Re: [PATCH v8] mm/mempolicy: Weighted Interleave Auto-tuning

Joshua Hahn
2025-05-12T14:25:17Z

On Mon, 12 May 2025 09:35:16 +0800 "Huang, Ying" <ying.huang@linux.alibaba.com> wrote:

> Hi, Joshua,
>
> Joshua Hahn <joshua.hahnjy@gmail.com> writes:
>
> [snip]
>
> > @@ -3707,8 +3720,12 @@ static void wi_state_free(void)
> > kfree(&wi_group->wi_kobj);
> > }
> >
> > +static struct kobj_attribute wi_auto_attr =
> > + __ATTR(auto, 0664, weighted_interleave_auto_show,
> > + weighted_interleave_auto_store);
> > +
> > static void wi_cleanup(void) {
> > - sysfs_remove_file(&wi_group->wi_kobj, &wi_group->auto_kobj_attr.attr);
> > + sysfs_remove_file(&wi_group->wi_kobj, &wi_auto_attr.attr);
>
> If we use wi_auto_attr directly here, we can remove auto_kobj_attr field
> from struct sysfs_wi_group?

Hi Ying, thank you for this comment. I should have caught it as well.
Removing the last users / setters doesn't seem complicated.

Andrew, I'm very sorry -- do you think you can fold this fixlet in as well?
This is a minor change that removes the only users of this variable.

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index d5ae36d2eda8..8581cc861945 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -3543,7 +3543,6 @@ struct iw_node_attr {
struct sysfs_wi_group {
struct kobject wi_kobj;
struct mutex kobj_lock;
- struct kobj_attribute auto_kobj_attr;
struct iw_node_attr *nattrs[];
};

@@ -3833,7 +3832,6 @@ static int __init add_weighted_interleave_group(struct kobject *mempolicy_kobj)
err = sysfs_create_file(&wi_group->wi_kobj, &wi_auto_attr.attr);
if (err)
goto err_put_kobj;
- wi_group->auto_kobj_attr = wi_auto_attr

for_each_online_node(nid) {
if (!node_state(nid, N_MEMORY))

Thank you both, I hope you have a great day!
Joshua