linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] shmem: make shmem default size a define value
@ 2019-10-09 18:46 Gary B. Genett
  2019-10-09 19:01 ` Qian Cai
  0 siblings, 1 reply; 5+ messages in thread
From: Gary B. Genett @ 2019-10-09 18:46 UTC (permalink / raw)
  To: Qian Cai, Vlastimil Babka; +Cc: Hugh Dickins, linux-mm

The default size of the shmem filesystem is currently set to 50% of
memory using a magic token.  This change makes it a define value, so
that it is clearly denoted as a global value, and to make it easier to
track down and identify.

No behavior is changed, and no additional processing is created.

Signed-off-by: Gary B. Genett <me@garybgenett.net>
---
 mm/shmem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index cd570cc79c76..bc758cfb4cb6 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -95,6 +95,9 @@ static struct vfsmount *shm_mnt;
 /* Symlink up to this size is kmalloc'ed instead of using a swappable page */
 #define SHORT_SYMLINK_LEN 128

+/* Default size of shmem filesystem */
+#define SHMEM_SIZE_DEFAULT (totalram_pages() / 2)
+
 /*
  * shmem_fallocate communicates with shmem_fault or shmem_writepage via
  * inode->i_private (with i_mutex making sure that it has only one user at
@@ -125,14 +128,14 @@ struct shmem_options {
 #ifdef CONFIG_TMPFS
 static unsigned long shmem_default_max_blocks(void)
 {
-	return totalram_pages() / 2;
+	return SHMEM_SIZE_DEFAULT;
 }

 static unsigned long shmem_default_max_inodes(void)
 {
 	unsigned long nr_pages = totalram_pages();

-	return min(nr_pages - totalhigh_pages(), nr_pages / 2);
+	return min(nr_pages - totalhigh_pages(), SHMEM_SIZE_DEFAULT);
 }
 #endif

--
2.15.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-09 23:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 18:46 [PATCH] shmem: make shmem default size a define value Gary B. Genett
2019-10-09 19:01 ` Qian Cai
2019-10-09 20:17   ` -Gary-
2019-10-09 20:56     ` Qian Cai
2019-10-09 23:17       ` -Gary-

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).