Skip to contentSkip to conversation

tmpfsxattr-gfp_kernel_account-for-simple-xattrs.patch removed from -mm tree

merged Andrew Morton 1 participant 1 message Aug 22, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: tmpfs,xattr: GFP_KERNEL_ACCOUNT for simple xattrs
has been removed from the -mm tree. Its filename was
tmpfsxattr-gfp_kernel_account-for-simple-xattrs.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Hugh Dickins <[email protected]>
Subject: tmpfs,xattr: GFP_KERNEL_ACCOUNT for simple xattrs
Date: Mon, 21 Aug 2023 10:39:20 -0700 (PDT)

It is particularly important for the userns mount case (when a sensible nr_inodes maximum may not be enforced) that tmpfs user xattrs be subject to memory cgroup limiting. Leave temporary buffer allocations as is, but change the persistent simple xattr allocations from GFP_KERNEL to GFP_KERNEL_ACCOUNT. This limits kernfs's cgroupfs too, but that's good.

(I had intended to send this change earlier, but had been confused by shmem_alloc_inode() using GFP_KERNEL, and thought a discussion would be needed to change that too: no, I was forgetting the SLAB_ACCOUNT on that kmem_cache, which implicitly adds __GFP_ACCOUNT to all its allocations.)

Cc Carlos Maiolino <[email protected]>
Cc Chris Down <[email protected]>
Cc "Christian Brauner (Microsoft)" <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Chuck Lever <[email protected]>
Cc Daniel Xu <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Helge Deller <[email protected]>
Cc Jeff Layton <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Miklos Szeredi <[email protected]>
Cc Pete Zaitcev <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Topi Miettinen <[email protected]>
Cc Yu Kuai <[email protected]>

---

 fs/xattr.c |    4 ++--
 mm/shmem.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
fs/xattr.c renamed from fs/xattr.c~tmpfsxattr-gfp_kernel_account-for-simple-xattrs +2 -2
@@ -1073,7 +1073,7 @@ struct simple_xattr *simple_xattr_alloc(
 	if (len < sizeof(*new_xattr))
 		return NULL;
 
-	new_xattr = kvmalloc(len, GFP_KERNEL);
+	new_xattr = kvmalloc(len, GFP_KERNEL_ACCOUNT);
 	if (!new_xattr)
 		return NULL;
 
@@ -1200,7 +1200,7 @@ int simple_xattr_set(struct simple_xattr
 		if (!new_xattr)
 			return -ENOMEM;
 
-		new_xattr->name = kstrdup(name, GFP_KERNEL);
+		new_xattr->name = kstrdup(name, GFP_KERNEL_ACCOUNT);
 		if (!new_xattr->name) {
 			free_simple_xattr(new_xattr);
 			return -ENOMEM;
mm/shmem.c renamed from mm/shmem.c~tmpfsxattr-gfp_kernel_account-for-simple-xattrs +1 -1
@@ -3445,7 +3445,7 @@ static int shmem_initxattrs(struct inode
 
 		len = strlen(xattr->name) + 1;
 		new_xattr->name = kmalloc(XATTR_SECURITY_PREFIX_LEN + len,
-					  GFP_KERNEL);
+					  GFP_KERNEL_ACCOUNT);
 		if (!new_xattr->name) {
 			kvfree(new_xattr);
 			return -ENOMEM;

_

Patches currently in -mm which might be from [email protected] are