linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel Xu" <dxu@dxuuu.xyz>
To: "Joe Perches" <joe@perches.com>, <cgroups@vger.kernel.org>,
	<tj@kernel.org>, <lizefan@huawei.com>, <hannes@cmpxchg.org>
Cc: <shakeelb@google.com>, <linux-kernel@vger.kernel.org>,
	<gregkh@linuxfoundation.org>, <kernel-team@fb.com>
Subject: Re: [PATCH v2 1/4] kernfs: kvmalloc xattr value instead of kmalloc
Date: Mon, 09 Mar 2020 11:21:33 -0700	[thread overview]
Message-ID: <C16IH7NEXW4J.440OGTNY7CWX@dlxu-fedora-R90QNFJV> (raw)
In-Reply-To: <58c6e6dafabea52e5b030d18b83c13e4f43ab8e3.camel@perches.com>

Hi Joe,

On Fri Mar 6, 2020 at 12:49 AM, Joe Perches wrote:
> On Thu, 2020-03-05 at 13:16 -0800, Daniel Xu wrote:
> > It's not really necessary to have contiguous physical memory for xattr
> > values. We no longer need to worry about higher order allocations
> > failing with kvmalloc, especially because the xattr size limit is at
> > 64K.
>
> 
> So why use vmalloc memory at all?
>
> 
> > diff --git a/fs/xattr.c b/fs/xattr.c
> ']
> > @@ -817,7 +817,7 @@ struct simple_xattr *simple_xattr_alloc(const void *value, size_t size)
> >  	if (len < sizeof(*new_xattr))
> >  		return NULL;
> >  
> > -	new_xattr = kmalloc(len, GFP_KERNEL);
> > +	new_xattr = kvmalloc(len, GFP_KERNEL);
>
> 
> Why is this sensible?
> vmalloc memory is a much more limited resource.

What would be the alternative? As Greg said, contiguous memory should be
more scarce.

> Also, it seems as if the function should set
> new_xattr->name to NULL before the return.
>

Will add and send in a different patch.


Thanks,
Daniel

  parent reply	other threads:[~2020-03-09 18:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 21:16 [PATCH v2 0/4] Support user xattrs in cgroupfs Daniel Xu
2020-03-05 21:16 ` [PATCH v2 1/4] kernfs: kvmalloc xattr value instead of kmalloc Daniel Xu
2020-03-06  8:49   ` Joe Perches
2020-03-06  9:37     ` Greg KH
2020-03-09 18:21     ` Daniel Xu [this message]
2020-03-09 19:41       ` Joe Perches
2020-03-09 19:51         ` Tejun Heo
2020-03-09 19:58           ` Joe Perches
2020-03-09 20:05             ` Tejun Heo
2020-03-10 19:40   ` Shakeel Butt
2020-03-10 20:40     ` Daniel Xu
2020-03-10 20:41       ` Shakeel Butt
2020-03-05 21:16 ` [PATCH v2 2/4] kernfs: Add removed_size out param for simple_xattr_set Daniel Xu
2020-03-10 18:20   ` Daniel Xu
2020-03-05 21:16 ` [PATCH v2 3/4] kernfs: Add option to enable user xattrs Daniel Xu
2020-03-05 21:16 ` [PATCH v2 4/4] cgroupfs: Support " Daniel Xu

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=C16IH7NEXW4J.440OGTNY7CWX@dlxu-fedora-R90QNFJV \
    --to=dxu@dxuuu.xyz \
    --cc=cgroups@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=joe@perches.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=shakeelb@google.com \
    --cc=tj@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 NNTP newsgroup(s).