[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191105030451.GA55090@jaegeuk-macbookpro.roam.corp.google.com>
Date: Mon, 4 Nov 2019 19:04:51 -0800
From: Jaegeuk Kim <jaegeuk@...nel.org>
To: Chao Yu <yuchao0@...wei.com>
Cc: linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [PATCH 3/3] Revert "f2fs: use kvmalloc, if kmalloc is failed"
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,
Powered by blists - more mailing lists