All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aslan Bakirov <aslan@fb.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Kernel Team <Kernel-team@fb.com>,
	"riel@surriel.com" <riel@surriel.com>,
	Roman Gushchin <guro@fb.com>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>
Subject: Re: [PATCH 2/2] mm: hugetlb: Use node interface of cma
Date: Fri, 3 Apr 2020 11:21:05 +0000	[thread overview]
Message-ID: <MN2PR15MB35972EB0533A0548C264757CC0C70@MN2PR15MB3597.namprd15.prod.outlook.com> (raw)
In-Reply-To: <20200403103651.GA22681@dhcp22.suse.cz>

[-- Attachment #1: Type: text/plain, Size: 4494 bytes --]



________________________________
From: Michal Hocko <mhocko@kernel.org>
Sent: Friday, April 3, 2020 11:36 AM
To: Aslan Bakirov <aslan@fb.com>
Cc: akpm@linux-foundation.org <akpm@linux-foundation.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; linux-mm@kvack.org <linux-mm@kvack.org>; Kernel Team <Kernel-team@fb.com>; riel@surriel.com <riel@surriel.com>; Roman Gushchin <guro@fb.com>; hannes@cmpxchg.org <hannes@cmpxchg.org>
Subject: Re: [PATCH 2/2] mm: hugetlb: Use node interface of cma

On Fri 03-04-20 03:18:43, Aslan Bakirov wrote:
> With introduction of numa node interface for CMA, this patch is for using that
> interface for allocating memory on numa nodes if NUMA is configured.
> This will be more efficient  and cleaner because first, instead of iterating
> mem range of each numa node, cma_declare_contigueous_nid() will do
> its own address finding if we pass 0 for  both min_pfn and max_pfn,
> second, it can also handle caseswhere NUMA is not configured
> by passing NUMA_NO_NODE as an argument.
>
> In addition, checking if desired size of memory is available or not,
> is happening in cma_declare_contiguous_nid()  because base and
> limit will be determined there, since 0(any) for  base and
> 0(any) for limit is passed as argument to the function.

I have asked to merge this one with the original patch from Roman
several times but it seems this is not going to happen. But whatever.

You have likely missed my review feedback http://lkml.kernel.org/r/20200402172404.GV22681@dhcp22.suse.cz.
The ifdef CONFIG_NUMA for the nid definition is pointless.

> Signed-off-by: Aslan Bakirov <aslan@fb.com>

After fixing that, feel free to add
Acked-by: Michal Hocko <mhocko@suse.com>

Addressed  your comment, and updated the patch. Thanks Michal.

> ---
>  mm/hugetlb.c | 40 +++++++++++-----------------------------
>  1 file changed, 11 insertions(+), 29 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index b9f0c903c4cf..62989220c4ff 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -5573,42 +5573,24 @@ void __init hugetlb_cma_reserve(int order)
>
>        reserved = 0;
>        for_each_node_state(nid, N_ONLINE) {
> -             unsigned long min_pfn = 0, max_pfn = 0;
>                int res;
> -#ifdef CONFIG_NUMA
> -             unsigned long start_pfn, end_pfn;
> -             int i;
>
> -             for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) {
> -                     if (!min_pfn)
> -                             min_pfn = start_pfn;
> -                     max_pfn = end_pfn;
> -             }
> -#else
> -             min_pfn = min_low_pfn;
> -             max_pfn = max_low_pfn;
> -#endif
>                size = min(per_node, hugetlb_cma_size - reserved);
>                size = round_up(size, PAGE_SIZE << order);
> -
> -             if (size > ((max_pfn - min_pfn) << PAGE_SHIFT) / 2) {
> -                     pr_warn("hugetlb_cma: cma_area is too big, please try less than %lu MiB\n",
> -                             round_down(((max_pfn - min_pfn) << PAGE_SHIFT) *
> -                                        nr_online_nodes / 2 / SZ_1M,
> -                                        PAGE_SIZE << order));
> -                     break;
> -             }
> -
> -             res = cma_declare_contiguous(PFN_PHYS(min_pfn), size,
> -                                          PFN_PHYS(max_pfn),
> +
> +
> +#ifndef CONFIG_NUMA
> +             nid = NUMA_NO_NODE
> +#endif

> +             res = cma_declare_contiguous_nid(0, size,
> +                                          0,
>                                             PAGE_SIZE << order,
>                                             0, false,
> -                                          "hugetlb", &hugetlb_cma[nid]);
> +                                          "hugetlb", &hugetlb_cma[nid], nid);
> +
>                if (res) {
> -                     phys_addr_t begpa = PFN_PHYS(min_pfn);
> -                     phys_addr_t endpa = PFN_PHYS(max_pfn);
> -                     pr_warn("%s: reservation failed: err %d, node %d, [%pap, %pap)\n",
> -                             __func__, res, nid, &begpa, &endpa);
> +                     pr_warn("%s: reservation failed: err %d, node %d\n",
> +                             __func__, res, nid);
>                        break;
>                }
>
> --
> 2.24.1

--
Michal Hocko
SUSE Labs

[-- Attachment #2: Type: text/html, Size: 10980 bytes --]

  reply	other threads:[~2020-04-03 11:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 10:18 [PATCH 1/2] mm: cma: NUMA node interface Aslan Bakirov
2020-04-03 10:18 ` [PATCH 2/2] mm: hugetlb: Use node interface of cma Aslan Bakirov
2020-04-03 10:36   ` Michal Hocko
2020-04-03 11:21     ` Aslan Bakirov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-04-03 11:18 [PATCH 1/2] mm: cma: NUMA node interface Aslan Bakirov
2020-04-03 11:18 ` [PATCH 2/2] mm: hugetlb: Use node interface of cma Aslan Bakirov
2020-03-26 21:27 [PATCH 1/2] mm: cma: NUMA node interface Aslan Bakirov
2020-03-26 21:27 ` [PATCH 2/2] mm: hugetlb: Use node interface of cma Aslan Bakirov
2020-03-27  8:06   ` Michal Hocko
2020-03-27 14:41     ` Roman Gushchin
2020-03-27 15:13       ` Michal Hocko
2020-04-02 15:20         ` Vlastimil Babka
2020-04-02 17:24           ` Michal Hocko

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=MN2PR15MB35972EB0533A0548C264757CC0C70@MN2PR15MB3597.namprd15.prod.outlook.com \
    --to=aslan@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=riel@surriel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.