Linux-mm Archive mirror
 help / color / mirror / Atom feed
From: Hailong Liu <hailong.liu@oppo.com>
To: Barry Song <21cnbao@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>, <akpm@linux-foundation.org>,
	<urezki@gmail.com>, <hch@infradead.org>, <lstoakes@gmail.com>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<xiang@kernel.org>, <chao@kernel.org>,
	Oven <liyangouwen1@oppo.com>
Subject: Re: [RFC PATCH] mm/vmalloc: fix vmalloc which may return null if called with __GFP_NOFAIL
Date: Thu, 9 May 2024 17:50:30 +0800	[thread overview]
Message-ID: <20240509095030.t3gnhkuntj6t3w6p@oppo.com> (raw)
In-Reply-To: <CAGsJ_4xqg7+xwsbXpU1yp_HkTBcpJwRN-ErEwzOZx915hgsyrQ@mail.gmail.com>

On Thu, 09. May 20:57, Barry Song wrote:
>
> Upon further examination, it's not a bug, but we can still utilize 'nofail'.
> The current code is very hard to read about gfp and "nofail" :-)
>
> maybe:
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 6641be0ca80b..7c66fe16c2ad 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -3498,7 +3498,7 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
>  {
>         unsigned int nr_allocated = 0;
>         gfp_t alloc_gfp = gfp;
> -       bool nofail = false;
> +       bool nofail = !!(gfp & __GFP_NOFAIL);
>         struct page *page;
>         int i;
>
> @@ -3555,7 +3555,6 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
>                  * and compaction etc.
>                  */
>                 alloc_gfp &= ~__GFP_NOFAIL;
> -               nofail = true;
>         }

Thanks for suggestion. I think that makes more clearly. Will
try it in next version.

--

Best Regards,
Hailong.


      reply	other threads:[~2024-05-09  9:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 12:58 [RFC PATCH] mm/vmalloc: fix vmalloc which may return null if called with __GFP_NOFAIL hailong.liu
2024-05-08 13:41 ` Gao Xiang
2024-05-08 14:13   ` Gao Xiang
2024-05-08 14:43   ` Hailong Liu
2024-05-08 15:10     ` Gao Xiang
2024-05-08 15:31       ` Hailong Liu
2024-05-08 15:40         ` Gao Xiang
2024-05-09  1:30           ` Hailong Liu
2024-05-09  4:51             ` Christoph Hellwig
2024-05-09  2:20 ` Barry Song
2024-05-09  2:26   ` Barry Song
2024-05-09  2:30     ` Barry Song
2024-05-09  2:39   ` Gao Xiang
2024-05-09  3:09     ` Barry Song
2024-05-09  3:17       ` Gao Xiang
2024-05-09  3:11     ` Gao Xiang
2024-05-09  3:22     ` Hailong Liu
2024-05-09  3:33   ` Hailong Liu
2024-05-09  3:48     ` Barry Song
2024-05-09  4:19       ` Gao Xiang
2024-05-09  4:52   ` Christoph Hellwig
2024-05-09  6:12     ` Barry Song
2024-05-09  7:48 ` Michal Hocko
2024-05-09  8:06   ` Hailong Liu
2024-05-09  8:32     ` Barry Song
2024-05-09  8:57       ` Barry Song
2024-05-09  9:50         ` Hailong Liu [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=20240509095030.t3gnhkuntj6t3w6p@oppo.com \
    --to=hailong.liu@oppo.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chao@kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liyangouwen1@oppo.com \
    --cc=lstoakes@gmail.com \
    --cc=mhocko@suse.com \
    --cc=urezki@gmail.com \
    --cc=xiang@kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).