aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2022-09-01 20:00:26 +0800
committerAndrew Morton <akpm@linux-foundation.org>2022-09-11 20:26:09 -0700
commit12658abfc59ddf2ed176fce461e83f392ff18e5b (patch)
treeb34911a69de1dfb909086e5e29604042771d5ed6 /mm/hugetlb.c
parenthugetlb: use helper {huge_pte|pmd}_lock() (diff)
downloadlinux-dev-12658abfc59ddf2ed176fce461e83f392ff18e5b.tar.xz
linux-dev-12658abfc59ddf2ed176fce461e83f392ff18e5b.zip
hugetlb: pass NULL to kobj_to_hstate() if nid is unused
We can pass NULL to kobj_to_hstate() directly when nid is unused to simplify the code. No functional change intended. Link: https://lkml.kernel.org/r/20220901120030.63318-7-linmiaohe@huawei.com Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index cc1d85749766..10c63fe72afa 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3763,8 +3763,7 @@ HSTATE_ATTR_WO(demote);
static ssize_t demote_size_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
- int nid;
- struct hstate *h = kobj_to_hstate(kobj, &nid);
+ struct hstate *h = kobj_to_hstate(kobj, NULL);
unsigned long demote_size = (PAGE_SIZE << h->demote_order) / SZ_1K;
return sysfs_emit(buf, "%lukB\n", demote_size);
@@ -3777,7 +3776,6 @@ static ssize_t demote_size_store(struct kobject *kobj,
struct hstate *h, *demote_hstate;
unsigned long demote_size;
unsigned int demote_order;
- int nid;
demote_size = (unsigned long)memparse(buf, NULL);
@@ -3789,7 +3787,7 @@ static ssize_t demote_size_store(struct kobject *kobj,
return -EINVAL;
/* demote order must be smaller than hstate order */
- h = kobj_to_hstate(kobj, &nid);
+ h = kobj_to_hstate(kobj, NULL);
if (demote_order >= h->order)
return -EINVAL;