From: Wei Xu <weixugc@google.com>
To: "T.J. Alumbaugh" <talumbau@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-mm@google.com
Subject: Re: [PATCH mm-unstable v1 1/2] mm: multi-gen LRU: clean up sysfs code
Date: Thu, 16 Feb 2023 23:20:58 -0800 [thread overview]
Message-ID: <CAAPL-u_p64P+uupj-P-piRo=6d_ogadJMT5=waS0BtZ6ATFx7w@mail.gmail.com> (raw)
In-Reply-To: <20230214035445.1250139-1-talumbau@google.com>
Reviewed-by: Wei Xu <weixugc@google.com>
On Mon, Feb 13, 2023 at 7:54 PM T.J. Alumbaugh <talumbau@google.com> wrote:
>
> This patch cleans up the sysfs code. Specifically,
Nit: Remove "This patch" per the "submitting patches" guide.
> 1. use sysfs_emit(),
> 2. use __ATTR_RW(), and
> 3. constify multi-gen LRU struct attribute_group.
>
> Signed-off-by: T.J. Alumbaugh <talumbau@google.com>
> ---
> include/linux/mmzone.h | 2 +-
> mm/vmscan.c | 22 +++++++++-------------
> 2 files changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 9fb1b03b83b2..bf8786d45b31 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -1369,7 +1369,7 @@ typedef struct pglist_data {
>
> #ifdef CONFIG_LRU_GEN
> /* kswap mm walk data */
> - struct lru_gen_mm_walk mm_walk;
> + struct lru_gen_mm_walk mm_walk;
> /* lru_gen_folio list */
> struct lru_gen_memcg memcg_lru;
> #endif
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index d4b9fd1ae0ed..09c064accdb1 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -5658,14 +5658,14 @@ static void lru_gen_change_state(bool enabled)
> * sysfs interface
> ******************************************************************************/
>
> -static ssize_t show_min_ttl(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> +static ssize_t min_ttl_ms_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> {
> - return sprintf(buf, "%u\n", jiffies_to_msecs(READ_ONCE(lru_gen_min_ttl)));
> + return sysfs_emit(buf, "%u\n", jiffies_to_msecs(READ_ONCE(lru_gen_min_ttl)));
> }
>
> /* see Documentation/admin-guide/mm/multigen_lru.rst for details */
> -static ssize_t store_min_ttl(struct kobject *kobj, struct kobj_attribute *attr,
> - const char *buf, size_t len)
> +static ssize_t min_ttl_ms_store(struct kobject *kobj, struct kobj_attribute *attr,
> + const char *buf, size_t len)
> {
> unsigned int msecs;
>
> @@ -5677,11 +5677,9 @@ static ssize_t store_min_ttl(struct kobject *kobj, struct kobj_attribute *attr,
> return len;
> }
>
> -static struct kobj_attribute lru_gen_min_ttl_attr = __ATTR(
> - min_ttl_ms, 0644, show_min_ttl, store_min_ttl
> -);
> +static struct kobj_attribute lru_gen_min_ttl_attr = __ATTR_RW(min_ttl_ms);
>
> -static ssize_t show_enabled(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> +static ssize_t enabled_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> {
> unsigned int caps = 0;
>
> @@ -5698,7 +5696,7 @@ static ssize_t show_enabled(struct kobject *kobj, struct kobj_attribute *attr, c
> }
>
> /* see Documentation/admin-guide/mm/multigen_lru.rst for details */
> -static ssize_t store_enabled(struct kobject *kobj, struct kobj_attribute *attr,
> +static ssize_t enabled_store(struct kobject *kobj, struct kobj_attribute *attr,
> const char *buf, size_t len)
> {
> int i;
> @@ -5725,9 +5723,7 @@ static ssize_t store_enabled(struct kobject *kobj, struct kobj_attribute *attr,
> return len;
> }
>
> -static struct kobj_attribute lru_gen_enabled_attr = __ATTR(
> - enabled, 0644, show_enabled, store_enabled
> -);
> +static struct kobj_attribute lru_gen_enabled_attr = __ATTR_RW(enabled);
>
> static struct attribute *lru_gen_attrs[] = {
> &lru_gen_min_ttl_attr.attr,
> @@ -5735,7 +5731,7 @@ static struct attribute *lru_gen_attrs[] = {
> NULL
> };
>
> -static struct attribute_group lru_gen_attr_group = {
> +static const struct attribute_group lru_gen_attr_group = {
> .name = "lru_gen",
> .attrs = lru_gen_attrs,
> };
> --
> 2.39.1.581.gbfd45094c4-goog
>
>
prev parent reply other threads:[~2023-02-17 7:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 3:54 T.J. Alumbaugh
2023-02-14 3:54 ` [PATCH mm-unstable v1 2/2] mm: multi-gen LRU: improve design doc T.J. Alumbaugh
2023-02-17 7:20 ` Wei Xu [this message]
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='CAAPL-u_p64P+uupj-P-piRo=6d_ogadJMT5=waS0BtZ6ATFx7w@mail.gmail.com' \
--to=weixugc@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@google.com \
--cc=linux-mm@kvack.org \
--cc=talumbau@google.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