lkml.org 
[lkml]   [2022]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v6 03/13] mm/demotion: Return error on write to numa_demotion sysfs
From
Date
On Mon, 2022-06-13 at 09:05 +0530, Aneesh Kumar K V wrote:
> On 6/13/22 8:56 AM, Ying Huang wrote:
> > On Fri, 2022-06-10 at 19:22 +0530, Aneesh Kumar K.V wrote:
> > > With CONFIG_MIGRATION disabled return EINVAL on write.
> > >
> > > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> > > ---
> > >   mm/memory-tiers.c | 3 +++
> > >   1 file changed, 3 insertions(+)
> > >
> > > diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
> > > index 9c6b40d7e0bf..c3123a457d90 100644
> > > --- a/mm/memory-tiers.c
> > > +++ b/mm/memory-tiers.c
> > > @@ -105,6 +105,9 @@ static ssize_t numa_demotion_enabled_store(struct kobject *kobj,
> > >   {
> > >    ssize_t ret;
> > >   
> > >
> > >
> > > + if (!IS_ENABLED(CONFIG_MIGRATION))
> > > + return -EINVAL;
> > > +
> >
> > How about enclose numa_demotion_enabled_xxx related code with CONFIG_MIGRATION?
> >
>
> IIUC there is a desire to use IS_ENABLED() in the kernel instead of
> #ifdef since that helps in more compile time checks. Because there are
> no dead codes during compile now with IS_ENABLED().

IS_ENABLED() is used to reduce usage of "#ifdef" in ".c" file,
especially inside a function. We have good build test coverage with
0Day now.

To avoid code size inflate, it's better to use #ifdef CONFIG_MIGRATION.

> W.r.t leaving the sysfs file visible even when CONFIG_MIGRATION is
> disabled, I was thinking it gives better visibility into numa_demotion
> status. I could switch to hide numa_demotion file if that is desirable.
>
> > >    ret = kstrtobool(buf, &numa_demotion_enabled);
> > >    if (ret)
> > >    return ret;
> >

Best Regards,
Huang, Ying

\
 
 \ /
  Last update: 2022-06-13 07:34    [W:0.494 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site