[folded-merged] dcache-account-external-names-as-indirectly-reclaimable-memory-fix.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: dcache: fix indirectly reclaimable memory accounting for CONFIG_SLOB
has been removed from the -mm tree.  Its filename was
     dcache-account-external-names-as-indirectly-reclaimable-memory-fix.patch

This patch was dropped because it was folded into dcache-account-external-names-as-indirectly-reclaimable-memory.patch

------------------------------------------------------
From: Roman Gushchin <guro@xxxxxx>
Subject: dcache: fix indirectly reclaimable memory accounting for CONFIG_SLOB

Indirectly reclaimable memory accounting uses
kmalloc_size()/kmalloc_index() functions to estimate amount of consumed
memory.  kmalloc_size() always returns 0 and kmalloc_index() is not
defined for CONFIG_SLOB, and so it breaks the build.

Fix this by using ksize() function instead.

Slub:
$ cat /proc/meminfo | grep Avail
MemAvailable:    7857112 kB
$ python indirect.py
$ cat /proc/meminfo | grep Avail
MemAvailable:    7781312 kB

Slob:
$ cat /proc/meminfo | grep Avail
MemAvailable:    7853272 kB
$ python indirect.py
$ cat /proc/meminfo | grep Avail
MemAvailable:    7616644 kB

indirect.py:
  import os

  for iter in range (0, 1000000):
      try:
          name = ("/some_long_name_%d" % iter) + "_" * 220
          os.stat(name)
      except Exception:
          pass

Link: http://lkml.kernel.org/r/20180312194140.19517-1-guro@xxxxxx
Signed-off-by: Roman Gushchin <guro@xxxxxx>
Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Tony Lindgren <tony@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---


diff -puN fs/dcache.c~dcache-account-external-names-as-indirectly-reclaimable-memory-fix fs/dcache.c
--- a/fs/dcache.c~dcache-account-external-names-as-indirectly-reclaimable-memory-fix
+++ a/fs/dcache.c
@@ -261,12 +261,10 @@ static void __d_free_external(struct rcu
 {
 	struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
 	struct external_name *name = external_name(dentry);
-	unsigned long bytes;
 
-	bytes = dentry->d_name.len + offsetof(struct external_name, name[1]);
 	mod_node_page_state(page_pgdat(virt_to_page(name)),
 			    NR_INDIRECTLY_RECLAIMABLE_BYTES,
-			    -kmalloc_size(kmalloc_index(bytes)));
+			    -ksize(name));
 
 	kfree(name);
 	kmem_cache_free(dentry_cache, dentry);
@@ -1626,10 +1624,10 @@ EXPORT_SYMBOL(d_invalidate);
  
 struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
 {
+	struct external_name *ext = NULL;
 	struct dentry *dentry;
 	char *dname;
 	int err;
-	size_t reclaimable = 0;
 
 	dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
 	if (!dentry)
@@ -1646,17 +1644,15 @@ struct dentry *__d_alloc(struct super_bl
 		name = &slash_name;
 		dname = dentry->d_iname;
 	} else if (name->len > DNAME_INLINE_LEN-1) {
-		struct external_name *p;
+		size_t size = offsetof(struct external_name, name[1]);
 
-		reclaimable = offsetof(struct external_name, name[1]) +
-			name->len;
-		p = kmalloc(reclaimable, GFP_KERNEL_ACCOUNT);
-		if (!p) {
+		ext = kmalloc(size + name->len, GFP_KERNEL_ACCOUNT);
+		if (!ext) {
 			kmem_cache_free(dentry_cache, dentry); 
 			return NULL;
 		}
-		atomic_set(&p->u.count, 1);
-		dname = p->name;
+		atomic_set(&ext->u.count, 1);
+		dname = ext->name;
 	} else  {
 		dname = dentry->d_iname;
 	}	
@@ -1695,12 +1691,10 @@ struct dentry *__d_alloc(struct super_bl
 		}
 	}
 
-	if (unlikely(reclaimable)) {
-		pg_data_t *pgdat;
-
-		pgdat = page_pgdat(virt_to_page(external_name(dentry)));
+	if (unlikely(ext)) {
+		pg_data_t *pgdat = page_pgdat(virt_to_page(ext));
 		mod_node_page_state(pgdat, NR_INDIRECTLY_RECLAIMABLE_BYTES,
-				    kmalloc_size(kmalloc_index(reclaimable)));
+				    ksize(ext));
 	}
 
 	this_cpu_inc(nr_dentry);
_

Patches currently in -mm which might be from guro@xxxxxx are

mm-introduce-nr_indirectly_reclaimable_bytes.patch
mm-treat-indirectly-reclaimable-memory-as-available-in-memavailable.patch
dcache-account-external-names-as-indirectly-reclaimable-memory.patch
dcache-account-external-names-as-indirectly-reclaimable-memory-fix-2.patch
mm-treat-indirectly-reclaimable-memory-as-free-in-overcommit-logic.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux