mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 3/3] Revert "f2fs: use kvmalloc, if kmalloc is failed"
Date: Mon, 4 Nov 2019 19:04:51 -0800	[thread overview]
Message-ID: <20191105030451.GA55090@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <00ade77c-5451-4953-0232-89342a029f33@huawei.com>

On 11/05, Chao Yu wrote:
> On 2019/11/5 10:38, Eric Biggers wrote:
> > On Tue, Nov 05, 2019 at 10:17:41AM +0800, Chao Yu wrote:
> >> On 2019/11/5 8:02, Jaegeuk Kim wrote:
> >>> On 11/01, Chao Yu wrote:
> >>>> This reverts commit 5222595d093ebe80329d38d255d14316257afb3e.
> >>>>
> >>>> As discussed with Eric, as kvmalloc() will try kmalloc() first, so
> >>>> when we need allocate large size memory, it'd better to use
> >>>> f2fs_kvmalloc() directly rather than adding additional fallback
> >>>> logic to call kvmalloc() after we failed in f2fs_kmalloc().
> >>>>
> >>>> In order to avoid allocation failure described in original commit,
> >>>> I change to use f2fs_kvmalloc() for .free_nid_bitmap bitmap memory.
> >>>
> >>> Is there any problem in the previous flow?
> >>
> >> No existing problem, however, it's redundant to introduce fallback flow in
> >> f2fs_kmalloc() like vmalloc() did, since we can call f2fs_vmalloc() directly in
> >> places where we need large memory.
> >>
> >> Thanks,
> >>
> > 
> > f2fs_kmalloc() also violated the naming convention used everywhere else in the
> > kernel since it could return both kmalloc and vmalloc memory, not just kmalloc
> > memory.  That's really error-prone since people would naturally assume it's safe
> > to free the *_kmalloc()-ed memory with kfree().
> 
> Agreed.

Then, why not just keeping f2fs_kvmalloc() and replace all f2fs_kmalloc() with
f2fs_kvmalloc()?

f2fs_kvmalloc()
- call kmalloc()
- vmalloc(), if failed

I'd like to keep the allocation behavior first.

Thanks,

      reply	other threads:[~2019-11-05  3:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01  9:53 [PATCH 1/3] f2fs: clean up check condition for writting beyond EOF Chao Yu
2019-11-01  9:53 ` [PATCH 2/3] f2fs: show f2fs instance in printk_ratelimited Chao Yu
2019-11-01  9:53 ` [PATCH 3/3] Revert "f2fs: use kvmalloc, if kmalloc is failed" Chao Yu
2019-11-02 14:17   ` kbuild test robot
2019-11-04  8:03     ` Chao Yu
2019-11-05  0:02   ` Jaegeuk Kim
2019-11-05  2:17     ` Chao Yu
2019-11-05  2:38       ` Eric Biggers
2019-11-05  2:49         ` Chao Yu
2019-11-05  3:04           ` Jaegeuk Kim [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=20191105030451.GA55090@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.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

all inboxes | Powered by JetHome®