lkml.org 
[lkml]   [2022]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 03/12] mm/damon: Implement a minimal stub for sysfs-based DAMON interface
Date
On Wed, 23 Feb 2022 19:33:31 +0100 Greg KH <gregkh@linuxfoundation.org> wrote:

> On Wed, Feb 23, 2022 at 05:13:41PM +0000, SeongJae Park wrote:
> > On Wed, 23 Feb 2022 16:45:13 +0000 SeongJae Park <sj@kernel.org> wrote:
> >
> > > On Wed, 23 Feb 2022 17:09:38 +0100 Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > > On Wed, Feb 23, 2022 at 03:20:42PM +0000, SeongJae Park wrote:
> > > > > +static struct kobj_attribute damon_sysfs_ul_range_min_attr =
> > > > > + __ATTR(min, 0600, damon_sysfs_ul_range_min_show,
> > > > > + damon_sysfs_ul_range_min_store);
> > > > > +
> > > > > +static struct kobj_attribute damon_sysfs_ul_range_max_attr =
> > > > > + __ATTR(max, 0600, damon_sysfs_ul_range_max_show,
> > > > > + damon_sysfs_ul_range_max_store);
> > > >
> > > > Can you use __ATTR_RW_MODE() instead here and elsewhere?
> > >
> > > Sure, I will, in the next revision.
> >
> > After thinking once more, I realized that it might not so simple. First of
> > all, there are two files having same name in different directories
> > (kdamonds/<N>/pid and targets/<N>/pid). The files work differently, so I need
> > to use different _show/_store callbacks for them but __ATTR_RW_MODE() wouldn't
> > support the case.
>
> The reason I recommend using these macros is to prevent you from having
> sysfs files with the same name, yet doing different things in different
> places in the sysfs tree :)

Thank you for clarifying! Maybe I was making the hierarchy unnecessarily deep
and thus naming files too short and/or common, which could confuses relative
paths users.

>
> > Secondly, I'd like to keep the file names short because the meaning of the
> > files can easily inferred from the hierarchy, but want to keep the _show/_store
> > callback names to have prefixes that allows us easily know their meaning and
> > usage even though it makes the name a little bit longer because I don't want to
> > have too much source files for DAMON sysfs interface.
> >
> > Am I missing some of your point?
>
> How about renaming one of the files?

Thank you for the suggestion, will do so.


Thanks,
SJ

\
 
 \ /
  Last update: 2022-02-23 20:04    [W:0.025 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site