linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hugetlb: use helper macro __ATTR_RW
@ 2022-02-22 11:27 Miaohe Lin
  2022-02-23  0:27 ` Mike Kravetz
  2022-02-24 10:38 ` Muchun Song
  0 siblings, 2 replies; 3+ messages in thread
From: Miaohe Lin @ 2022-02-22 11:27 UTC (permalink / raw)
  To: akpm, mike.kravetz; +Cc: linux-mm, linux-kernel, linmiaohe

Use helper macro __ATTR_RW to define HSTATE_ATTR to make code more
clear. Minor readability improvement.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/hugetlb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 1f0cca036f7f..c0405f3c8413 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3498,8 +3498,7 @@ static int demote_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed)
 	static struct kobj_attribute _name##_attr = __ATTR_WO(_name)
 
 #define HSTATE_ATTR(_name) \
-	static struct kobj_attribute _name##_attr = \
-		__ATTR(_name, 0644, _name##_show, _name##_store)
+	static struct kobj_attribute _name##_attr = __ATTR_RW(_name)
 
 static struct kobject *hugepages_kobj;
 static struct kobject *hstate_kobjs[HUGE_MAX_HSTATE];
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/hugetlb: use helper macro __ATTR_RW
  2022-02-22 11:27 [PATCH] mm/hugetlb: use helper macro __ATTR_RW Miaohe Lin
@ 2022-02-23  0:27 ` Mike Kravetz
  2022-02-24 10:38 ` Muchun Song
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Kravetz @ 2022-02-23  0:27 UTC (permalink / raw)
  To: Miaohe Lin, akpm; +Cc: linux-mm, linux-kernel

On 2/22/22 03:27, Miaohe Lin wrote:
> Use helper macro __ATTR_RW to define HSTATE_ATTR to make code more
> clear. Minor readability improvement.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/hugetlb.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Thanks!

I should have noticed and changed that when adding HSTATE_ATTR_WO.

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
-- 
Mike Kravetz

> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 1f0cca036f7f..c0405f3c8413 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -3498,8 +3498,7 @@ static int demote_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed)
>  	static struct kobj_attribute _name##_attr = __ATTR_WO(_name)
>  
>  #define HSTATE_ATTR(_name) \
> -	static struct kobj_attribute _name##_attr = \
> -		__ATTR(_name, 0644, _name##_show, _name##_store)
> +	static struct kobj_attribute _name##_attr = __ATTR_RW(_name)
>  
>  static struct kobject *hugepages_kobj;
>  static struct kobject *hstate_kobjs[HUGE_MAX_HSTATE];



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/hugetlb: use helper macro __ATTR_RW
  2022-02-22 11:27 [PATCH] mm/hugetlb: use helper macro __ATTR_RW Miaohe Lin
  2022-02-23  0:27 ` Mike Kravetz
@ 2022-02-24 10:38 ` Muchun Song
  1 sibling, 0 replies; 3+ messages in thread
From: Muchun Song @ 2022-02-24 10:38 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: Andrew Morton, Mike Kravetz, Linux Memory Management List, LKML

On Tue, Feb 22, 2022 at 7:28 PM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> Use helper macro __ATTR_RW to define HSTATE_ATTR to make code more
> clear. Minor readability improvement.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

More simple.

Reviewed-by: Muchun Song <songmuchun@bytedance.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-24 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 11:27 [PATCH] mm/hugetlb: use helper macro __ATTR_RW Miaohe Lin
2022-02-23  0:27 ` Mike Kravetz
2022-02-24 10:38 ` Muchun Song

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).