Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1375721

Re: [PATCH 03/31] huge tmpfs: huge=N mount option and /proc/sys/vm/shmem_huge

From "Kirill A. Shutemov" <kirill@shutemov.name>
Newsgroups linux.kernel
Subject Re: [PATCH 03/31] huge tmpfs: huge=N mount option and /proc/sys/vm/shmem_huge
Date 2016-04-11 13:20 +0200
Message-ID <rmI2T-4Vk-45@gated-at.bofh.it> (permalink)
References <rkGye-1F1-7@gated-at.bofh.it> <rkGyf-1F1-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Apr 05, 2016 at 02:15:05PM -0700, Hugh Dickins wrote:
> Plumb in a new "huge=1" or "huge=0" mount option to tmpfs: I don't
> want to get into a maze of boot options, madvises and fadvises at
> this stage, nor extend the use of the existing THP tuning to tmpfs;
> though either might be pursued later on.  We just want a way to ask
> a tmpfs filesystem to favor huge pages, and a way to turn that off
> again when it doesn't work out so well.  Default of course is off.
> 
> "mount -o remount,huge=N /mountpoint" works fine after mount:
> remounting from huge=1 (on) to huge=0 (off) will not attempt to
> break up huge pages at all, just stop more from being allocated.
> 
> It's possible that we shall allow more values for the option later,
> to select different strategies (e.g. how hard to try when allocating
> huge pages, or when to map hugely and when not, or how sparse a huge
> page should be before it is split up), either for experiments, or well
> baked in: so use an unsigned char in the superblock rather than a bool.

Make the value a string from beginning would be better choice in my
opinion. As more allocation policies would be implemented, number would
not make much sense.

For record, my implementation has four allocation policies: never, always,
within_size and advise.

> 
> No new config option: put this under CONFIG_TRANSPARENT_HUGEPAGE,
> which is the appropriate option to protect those who don't want
> the new bloat, and with which we shall share some pmd code.  Use a
> "name=numeric_value" format like most other tmpfs options.  Prohibit
> the option when !CONFIG_TRANSPARENT_HUGEPAGE, just as mpol is invalid
> without CONFIG_NUMA (was hidden in mpol_parse_str(): make it explicit).
> Allow setting >0 only if the machine has_transparent_hugepage().
> 
> But what about Shmem with no user-visible mount?  SysV SHM, memfds,
> shared anonymous mmaps (of /dev/zero or MAP_ANONYMOUS), GPU drivers'
> DRM objects, ashmem.  Though unlikely to suit all usages, provide
> sysctl /proc/sys/vm/shmem_huge to experiment with huge on those.  We
> may add a memfd_create flag and a per-file huge/non-huge fcntl later.

I use sysfs knob instead:

/sys/kernel/mm/transparent_hugepage/shmem_enabled

And string values there as well. It's better match current THP interface.

> And allow shmem_huge two further values: -1 for use in emergencies,
> to force the huge option off from all mounts; and (currently) 2,
> to force the huge option on for all - very useful for testing.

In my case, it's "deny" and "force".

-- 
 Kirill A. Shutemov

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/31] huge tmpfs: THPagecache implemented by teams Hugh Dickins <hughd@google.com> - 2016-04-05 23:20 +0200
  [PATCH 03/31] huge tmpfs: huge=N mount option and  /proc/sys/vm/shmem_huge Hugh Dickins <hughd@google.com> - 2016-04-05 23:20 +0200
    Re: [PATCH 03/31] huge tmpfs: huge=N mount option and  /proc/sys/vm/shmem_huge "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-04-11 13:20 +0200
  [PATCH 02/31] huge tmpfs: include shmem freeholes in available  memory Hugh Dickins <hughd@google.com> - 2016-04-05 23:20 +0200
  [PATCH 08/31] huge tmpfs: try_to_unmap_one use  page_check_address_transhuge Hugh Dickins <hughd@google.com> - 2016-04-05 23:30 +0200
  [PATCH 11/31] huge tmpfs: disband split huge pmds on race or memory  failure Hugh Dickins <hughd@google.com> - 2016-04-05 23:30 +0200
  [PATCH 06/31] huge tmpfs: shrinker to migrate and free underused  holes Hugh Dickins <hughd@google.com> - 2016-04-05 23:30 +0200
  [PATCH 10/31] huge tmpfs: map shmem by huge page pmd or by page team  ptes Hugh Dickins <hughd@google.com> - 2016-04-05 23:30 +0200
  [PATCH 07/31] huge tmpfs: get_unmapped_area align & fault supply  huge page Hugh Dickins <hughd@google.com> - 2016-04-05 23:30 +0200
  [PATCH 09/31] huge tmpfs: avoid premature exposure of new  pagetable Hugh Dickins <hughd@google.com> - 2016-04-05 23:30 +0200
    Re: [PATCH 09/31] huge tmpfs: avoid premature exposure of new  pagetable "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-04-11 14:00 +0200
  [PATCH 13/31] huge tmpfs: use Unevictable lru with variable  hpage_nr_pages Hugh Dickins <hughd@google.com> - 2016-04-05 23:40 +0200
  [PATCH 12/31] huge tmpfs: extend get_user_pages_fast to shmem pmd Hugh Dickins <hughd@google.com> - 2016-04-05 23:40 +0200
    Re: [PATCH 12/31] huge tmpfs: extend get_user_pages_fast to shmem pmd Ingo Molnar <mingo@kernel.org> - 2016-04-06 09:10 +0200
      Re: [PATCH 12/31] huge tmpfs: extend get_user_pages_fast to shmem  pmd Hugh Dickins <hughd@google.com> - 2016-04-07 05:00 +0200
        Re: [PATCH 12/31] huge tmpfs: extend get_user_pages_fast to shmem pmd Ingo Molnar <mingo@kernel.org> - 2016-04-13 11:00 +0200
  [PATCH 16/31] kvm: plumb return of hva when resolving page fault. Hugh Dickins <hughd@google.com> - 2016-04-05 23:40 +0200
  [PATCH 14/31] huge tmpfs: fix Mlocked meminfo, track huge & unhuge  mlocks Hugh Dickins <hughd@google.com> - 2016-04-05 23:40 +0200
  [PATCH 15/31] huge tmpfs: fix Mapped meminfo, track huge & unhuge  mappings Hugh Dickins <hughd@google.com> - 2016-04-05 23:40 +0200
  [PATCH 18/31] huge tmpfs: mem_cgroup move charge on shmem huge  pages Hugh Dickins <hughd@google.com> - 2016-04-05 23:50 +0200
  [PATCH 17/31] kvm: teach kvm to map page teams as huge pages. Hugh Dickins <hughd@google.com> - 2016-04-05 23:50 +0200
    Re: [PATCH 17/31] kvm: teach kvm to map page teams as huge pages. Paolo Bonzini <pbonzini@redhat.com> - 2016-04-06 01:40 +0200
      Re: [PATCH 17/31] kvm: teach kvm to map page teams as huge pages. Hugh Dickins <hughd@google.com> - 2016-04-06 03:20 +0200
        Re: [PATCH 17/31] kvm: teach kvm to map page teams as huge pages. Paolo Bonzini <pbonzini@redhat.com> - 2016-04-06 08:50 +0200
  [PATCH 19/31] huge tmpfs: mem_cgroup shmem_pmdmapped accounting Hugh Dickins <hughd@google.com> - 2016-04-05 23:50 +0200
  [PATCH 20/31] huge tmpfs: mem_cgroup shmem_hugepages accounting Hugh Dickins <hughd@google.com> - 2016-04-05 23:50 +0200
  [PATCH 22/31] huge tmpfs: /proc/<pid>/smaps show ShmemHugePages Hugh Dickins <hughd@google.com> - 2016-04-06 00:00 +0200
  [PATCH 24/31] huge tmpfs recovery: shmem_recovery_populate to fill  huge page Hugh Dickins <hughd@google.com> - 2016-04-06 00:00 +0200
  [PATCH 21/31] huge tmpfs: show page team flag in pageflags Hugh Dickins <hughd@google.com> - 2016-04-06 00:00 +0200
  [PATCH 25/31] huge tmpfs recovery: shmem_recovery_remap &  remap_team_by_pmd Hugh Dickins <hughd@google.com> - 2016-04-06 00:00 +0200
  [PATCH 26/31] huge tmpfs recovery: shmem_recovery_swapin to read  from swap Hugh Dickins <hughd@google.com> - 2016-04-06 00:00 +0200
  [PATCH 23/31] huge tmpfs recovery: framework for reconstituting huge  pages Hugh Dickins <hughd@google.com> - 2016-04-06 00:00 +0200
    Re: [PATCH 23/31] huge tmpfs recovery: framework for reconstituting  huge pages Mika Penttilä <mika.penttila@nextfour.com> - 2016-04-06 12:30 +0200
      Re: [PATCH 23/31] huge tmpfs recovery: framework for reconstituting  huge pages Hugh Dickins <hughd@google.com> - 2016-04-07 04:10 +0200
  [PATCH 31/31] huge tmpfs: no kswapd by default on sync allocations Hugh Dickins <hughd@google.com> - 2016-04-06 00:10 +0200
  [PATCH 27/31] huge tmpfs recovery: tweak shmem_getpage_gfp to fill  team Hugh Dickins <hughd@google.com> - 2016-04-06 00:10 +0200
  [PATCH 28/31] huge tmpfs recovery: debugfs stats to complete this  phase Hugh Dickins <hughd@google.com> - 2016-04-06 00:10 +0200
  [PATCH 30/31] huge tmpfs: shmem_huge_gfpmask and  shmem_recovery_gfpmask Hugh Dickins <hughd@google.com> - 2016-04-06 00:10 +0200
  [PATCH 29/31] huge tmpfs recovery: page migration call back into  shmem Hugh Dickins <hughd@google.com> - 2016-04-06 00:10 +0200

csiph-web