Re: [mm-unstable v7 13/18] proc/smaps: add PMDMappable field to smaps

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

 



On Wed, Jul 6, 2022 at 5:06 PM Zach O'Keefe <zokeefe@xxxxxxxxxx> wrote:
>
> Add PMDMappable field to smaps output which informs the user if memory
> in the VMA can be PMD-mapped by MADV_COLLAPSE.
>
> The distinction from THPeligible is needed for two reasons:
>
> 1) For THP, MADV_COLLAPSE is not coupled to THP sysfs controls, which
>    THPeligible reports.
>
> 2) PMDMappable can also be used in HugeTLB fine-granularity mappings,
>    which are independent from THP.

Could you please elaborate the usecase? The user checks this hint
before calling MADV_COLLAPSE? Is it really necessary?

And, TBH it sounds confusing and we don't have to maintain both
THPeligible and PMDMappable. We could just relax THPeligible to make
it return 1 even though THP is disabled by sysfs but MADV_COLLAPSE
could collapse it if such hint is useful.


>
> Signed-off-by: Zach O'Keefe <zokeefe@xxxxxxxxxx>
> ---
>  Documentation/filesystems/proc.rst | 10 ++++++++--
>  fs/proc/task_mmu.c                 |  2 ++
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst
> index 47e95dbc820d..f207903a57a5 100644
> --- a/Documentation/filesystems/proc.rst
> +++ b/Documentation/filesystems/proc.rst
> @@ -466,6 +466,7 @@ Memory Area, or VMA) there is a series of lines such as the following::
>      MMUPageSize:           4 kB
>      Locked:                0 kB
>      THPeligible:           0
> +    PMDMappable:           0
>      VmFlags: rd ex mr mw me dw
>
>  The first of these lines shows the same information as is displayed for the
> @@ -518,9 +519,14 @@ replaced by copy-on-write) part of the underlying shmem object out on swap.
>  does not take into account swapped out page of underlying shmem objects.
>  "Locked" indicates whether the mapping is locked in memory or not.
>
> +"PMDMappable" indicates if the memory can be mapped by PMDs - 1 if true, 0
> +otherwise.  It just shows the current status. Note that this is memory
> +operable on explicitly by MADV_COLLAPSE.
> +
>  "THPeligible" indicates whether the mapping is eligible for allocating THP
> -pages as well as the THP is PMD mappable or not - 1 if true, 0 otherwise.
> -It just shows the current status.
> +pages by the kernel, as well as the THP is PMD mappable or not - 1 if true, 0
> +otherwise. It just shows the current status.  Note this is memory the kernel can
> +transparently provide as THPs.
>
>  "VmFlags" field deserves a separate description. This member represents the
>  kernel flags associated with the particular virtual memory area in two letter
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index f8cd58846a28..29f2089456ba 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -867,6 +867,8 @@ static int show_smap(struct seq_file *m, void *v)
>
>         seq_printf(m, "THPeligible:    %d\n",
>                    hugepage_vma_check(vma, vma->vm_flags, true, false, true));
> +       seq_printf(m, "PMDMappable:    %d\n",
> +                  hugepage_vma_check(vma, vma->vm_flags, true, false, false));
>
>         if (arch_pkeys_enabled())
>                 seq_printf(m, "ProtectionKey:  %8u\n", vma_pkey(vma));
> --
> 2.37.0.rc0.161.g10f37bed90-goog
>




[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