diff mbox series

mm/hugetlb: use helper macro __ATTR_RW

Message ID 20220222112731.33479-1-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series mm/hugetlb: use helper macro __ATTR_RW | expand

Commit Message

Miaohe Lin Feb. 22, 2022, 11:27 a.m. UTC
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(-)

Comments

Mike Kravetz Feb. 23, 2022, 12:27 a.m. UTC | #1
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>
Muchun Song Feb. 24, 2022, 10:38 a.m. UTC | #2
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>
diff mbox series

Patch

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];