linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: "Gary B. Genett" <me@garybgenett.net>, Vlastimil Babka <vbabka@suse.cz>
Cc: Hugh Dickins <hughd@google.com>, linux-mm@kvack.org
Subject: Re: [PATCH] shmem: make shmem default size a define value
Date: Wed, 09 Oct 2019 15:01:35 -0400	[thread overview]
Message-ID: <1570647695.5937.16.camel@lca.pw> (raw)
In-Reply-To: <20191009184604.GA5162@spider>

On Wed, 2019-10-09 at 11:46 -0700, Gary B. Genett wrote:
> 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();

This is now unused.

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


  reply	other threads:[~2019-10-09 19:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 18:46 [PATCH] shmem: make shmem default size a define value Gary B. Genett
2019-10-09 19:01 ` Qian Cai [this message]
2019-10-09 20:17   ` -Gary-
2019-10-09 20:56     ` Qian Cai
2019-10-09 23:17       ` -Gary-

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=1570647695.5937.16.camel@lca.pw \
    --to=cai@lca.pw \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=me@garybgenett.net \
    --cc=vbabka@suse.cz \
    /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).