rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Danilo Krummrich <dakr@kernel.org>
Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com,
	iamjoonsoo.kim@lge.com, akpm@linux-foundation.org,
	vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com,
	urezki@gmail.com, hch@infradead.org, kees@kernel.org,
	ojeda@kernel.org, wedsonaf@gmail.com, mhocko@kernel.org,
	mpe@ellerman.id.au, chandan.babu@oracle.com,
	christian.koenig@amd.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 2/2] mm: kvmalloc: align kvrealloc() with krealloc()
Date: Wed, 17 Jul 2024 20:19:26 -0700	[thread overview]
Message-ID: <ZpiJvj1_rKodpVSt@infradead.org> (raw)
In-Reply-To: <20240717222427.2211-3-dakr@kernel.org>

> +extern void *kvrealloc_noprof(const void *p, size_t size, gfp_t flags) __realloc_size(2);

Please drop the extern while you're at it and move the __realloc_size
attribute to a separate line.

> +static gfp_t to_kmalloc_flags(gfp_t flags, size_t size)
> +{
> +	if (size > PAGE_SIZE) {
> +		flags |= __GFP_NOWARN;
> +
> +		if (!(flags & __GFP_RETRY_MAYFAIL))
> +			flags |= __GFP_NORETRY;
> +
> +		/* nofail semantic is implemented by the vmalloc fallback */
> +		flags &= ~__GFP_NOFAIL;
> +	}
> +
> +	return flags;

The name for this function sounds a bit odd.  Maybe kmalloc_gfp_adjust
instead?  Also the comment explaining these flags tweaks should move
from the caller to this function.


  reply	other threads:[~2024-07-18  3:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17 22:24 [PATCH 0/2] Align kvrealloc() with krealloc() Danilo Krummrich
2024-07-17 22:24 ` [PATCH 1/2] mm: vmalloc: implement vrealloc() Danilo Krummrich
2024-07-18  3:16   ` Christoph Hellwig
2024-07-18 11:43     ` Danilo Krummrich
2024-07-23 11:28   ` Uladzislau Rezki
2024-07-23 13:44     ` Christoph Hellwig
2024-07-23 15:54       ` Uladzislau Rezki
2024-07-17 22:24 ` [PATCH 2/2] mm: kvmalloc: align kvrealloc() with krealloc() Danilo Krummrich
2024-07-18  3:19   ` Christoph Hellwig [this message]
2024-07-18 11:45     ` Danilo Krummrich

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=ZpiJvj1_rKodpVSt@infradead.org \
    --to=hch@infradead.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chandan.babu@oracle.com \
    --cc=christian.koenig@amd.com \
    --cc=cl@linux.com \
    --cc=dakr@kernel.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=ojeda@kernel.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=urezki@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=wedsonaf@gmail.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 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 NNTP newsgroup(s).