Thread (16 messages) 16 messages, 5 authors, 2020-03-10

Re: [PATCH v2 1/4] kernfs: kvmalloc xattr value instead of kmalloc

From: Joe Perches <joe@perches.com>
Date: 2020-03-06 08:51:30
Also in: lkml

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?
quoted hunk ↗ jump to hunk
diff --git a/fs/xattr.c b/fs/xattr.c
']
quoted hunk ↗ jump to hunk
@@ -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.

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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help