From: Zhenguo Yao <yaozhenguo1@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [bug report] hugetlbfs: extend the definition of hugepages parameter to support node allocation
Date: Tue, 5 Oct 2021 13:52:36 +0800 [thread overview]
Message-ID: <CA+WzARnYEnOOv_H5K=mSWhC0poBMDWdfkve0bug=NRZr7cwvLg@mail.gmail.com> (raw)
In-Reply-To: <20211001132220.GA7666@kili>
Thanks for your report, I have already updated this patch with the fix.
Link: https://lore.kernel.org/lkml/20211005054729.86457-1-yaozhenguo1@gmail.com/
Dan Carpenter <dan.carpenter@oracle.com> 于2021年10月1日周五 下午9:23写道:
>
> Hello Zhenguo Yao,
>
> The patch 67b2b441dc10: "hugetlbfs: extend the definition of
> hugepages parameter to support node allocation" from Sep 29, 2021,
> leads to the following
> Smatch static checker warning:
>
> mm/hugetlb.c:2957 __alloc_bootmem_huge_page()
> warn: ignoring unreachable code.
>
> mm/hugetlb.c
> 2940 int __alloc_bootmem_huge_page(struct hstate *h, int nid)
> 2941 {
> 2942 struct huge_bootmem_page *m;
> 2943 int nr_nodes, node;
> 2944
> 2945 if (nid >= nr_online_nodes)
> 2946 return 0;
> 2947 /* do node specific alloc */
> 2948 if (nid != NUMA_NO_NODE) {
> 2949 m = memblock_alloc_try_nid_raw(huge_page_size(h), huge_page_size(h),
> 2950 0, MEMBLOCK_ALLOC_ACCESSIBLE, nid);
> 2951 if (m)
> 2952 goto found;
> 2953 else
> 2954 return 0;
> 2955 }
> 2956 /* do all node balanced alloc */
> ^^^^^^^^
> This says that it's going to loop over "all nodes".
>
> --> 2957 for_each_node_mask_to_alloc(h, nr_nodes, node, &node_states[N_MEMORY]) {
> 2958 m = memblock_alloc_try_nid_raw(
> 2959 huge_page_size(h), huge_page_size(h),
> 2960 0, MEMBLOCK_ALLOC_ACCESSIBLE, node);
> 2961 /*
> 2962 * Use the beginning of the huge page to store the
> 2963 * huge_bootmem_page struct (until gather_bootmem
> 2964 * puts them into the mem_map).
> 2965 */
> 2966 if (m)
> 2967 goto found;
> 2968 else
> 2969 return 0;
>
> But it only checks the first node and then returns.
>
> 2970 }
> 2971
> 2972 found:
> 2973 /* Put them into a private list first because mem_map is not up yet */
> 2974 INIT_LIST_HEAD(&m->list);
> 2975 list_add(&m->list, &huge_boot_pages);
> 2976 m->hstate = h;
> 2977 return 1;
> 2978 }
>
> regards,
> dan carpenter
prev parent reply other threads:[~2021-10-05 5:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 13:22 Dan Carpenter
2021-10-05 5:52 ` Zhenguo Yao [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='CA+WzARnYEnOOv_H5K=mSWhC0poBMDWdfkve0bug=NRZr7cwvLg@mail.gmail.com' \
--to=yaozhenguo1@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-mm@kvack.org \
/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