public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Carlos Maiolino <cmaiolino@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: Remove kmem_zalloc_large()
Date: Wed, 26 Aug 2020 08:37:06 +1000	[thread overview]
Message-ID: <20200825223706.GR12131@dread.disaster.area> (raw)
In-Reply-To: <20200825143458.41887-1-cmaiolino@redhat.com>

On Tue, Aug 25, 2020 at 04:34:58PM +0200, Carlos Maiolino wrote:
> This patch aims to replace kmem_zalloc_large() with global kernel memory
> API. So, all its callers are now using kvzalloc() directly, so kmalloc()
> fallsback to vmalloc() automatically.
> 
> __GFP_RETRY_MAYFAIL has been set because according to memory documentation,
> it should be used in case kmalloc() is preferred over vmalloc().
> 
> Patch survives xfstests with large (32GiB) and small (4GiB) RAM memory amounts.
> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
>  fs/xfs/kmem.h          | 6 ------
>  fs/xfs/scrub/symlink.c | 4 +++-
>  fs/xfs/xfs_acl.c       | 3 ++-
>  fs/xfs/xfs_ioctl.c     | 5 +++--
>  fs/xfs/xfs_rtalloc.c   | 3 ++-
>  5 files changed, 10 insertions(+), 11 deletions(-)
> 
> I'm not entirely sure passing __GFP_RETRY_MAYFAIL is the right thing to do here,
> but since current api attempts a kmalloc before falling back to vmalloc, it
> seems to be correct to pass it.

I don't think __GFP_RETRY_MAYFAIL is necessary. If the allocation is
larger than ALLOC_ORDER_COSTLY (8 pages, I think) then kmalloc()
will fail rather than retry forever and then it falls back to
vmalloc. Hence I don't think we need to tell the kmalloc() it needs
to fail large allocations if it can't make progress...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2020-08-25 22:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 14:34 [PATCH] xfs: Remove kmem_zalloc_large() Carlos Maiolino
2020-08-25 22:37 ` Dave Chinner [this message]
2020-08-26 10:18   ` Carlos Maiolino

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=20200825223706.GR12131@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=cmaiolino@redhat.com \
    --cc=linux-xfs@vger.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