Re: [PATCH] shmem: make shmem default size a define value

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

 



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@xxxxxxxxxxxxxxx>
> ---
>  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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux