linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: SeongJae Park <sj@kernel.org>,
	akpm@linux-foundation.org, corbet@lwn.net,
	skhan@linuxfoundation.org, rientjes@google.com,
	xhao@linux.alibaba.com, linux-damon@amazon.com,
	linux-mm@kvack.org, linux-doc@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/12] mm/damon: Implement a minimal stub for sysfs-based DAMON interface
Date: Wed, 23 Feb 2022 19:03:37 +0000	[thread overview]
Message-ID: <20220223190337.1705-1-sj@kernel.org> (raw)
In-Reply-To: <YhZ9+xsQ2zNmTdjD@kroah.com>

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

  reply	other threads:[~2022-02-23 19:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 15:20 [PATCH 00/12] Introduce DAMON sysfs interface SeongJae Park
2022-02-23 15:20 ` [PATCH 01/12] mm/damon/core: Allow non-exclusive DAMON start/stop SeongJae Park
2022-02-23 15:20 ` [PATCH 02/12] mm/damon/core: Add number of each enum type values SeongJae Park
2022-02-23 15:20 ` [PATCH 03/12] mm/damon: Implement a minimal stub for sysfs-based DAMON interface SeongJae Park
2022-02-23 16:09   ` Greg KH
2022-02-23 16:45     ` SeongJae Park
2022-02-23 17:13       ` SeongJae Park
2022-02-23 18:33         ` Greg KH
2022-02-23 19:03           ` SeongJae Park [this message]
2022-02-25  7:21   ` xhao
2022-02-25  8:10     ` SeongJae Park
2022-02-23 15:20 ` [PATCH 04/12] mm/damon/sysfs: Link DAMON for virtual address spaces monitoring SeongJae Park
2022-02-23 15:20 ` [PATCH 05/12] mm/damon/sysfs: Support physical address space monitoring SeongJae Park
2022-02-23 15:20 ` [PATCH 06/12] mm/damon/sysfs: Support DAMON-based Operation Schemes SeongJae Park
2022-02-23 15:20 ` [PATCH 07/12] mm/damon/sysfs: Support DAMOS quotas SeongJae Park
2022-02-23 15:20 ` [PATCH 08/12] mm/damon/sysfs: Support schemes prioritization weights SeongJae Park
2022-02-23 15:20 ` [PATCH 09/12] mm/damon/sysfs: Support DAMOS watermarks SeongJae Park
2022-02-23 15:20 ` [PATCH 10/12] mm/damon/sysfs: Support DAMOS stats SeongJae Park
2022-02-23 15:20 ` [PATCH 11/12] selftests/damon: Add a test for DAMON sysfs interface SeongJae Park
2022-02-23 15:20 ` [PATCH 12/12] Docs/admin-guide/mm/damon/usage: Document " SeongJae Park
2022-02-23 16:07 ` [PATCH 00/12] Introduce " Greg KH
2022-02-23 16:44   ` SeongJae Park
2022-02-25  7:32 ` xhao
2022-02-25  8:05   ` SeongJae Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220223190337.1705-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-damon@amazon.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=skhan@linuxfoundation.org \
    --cc=xhao@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).