smaps: Report PMD page size for pure PMD mappings
Subsystems (3)
PATCH v3 1/1 smaps: Report PMD page size for pure PMD mappings
When a smaps mapping is only PMD mappings report the PMD page size for MMUPageSize instead of the base page size.
This is a revised version of an earlier patch that tried to report multiple page sizes, but there were many objections mainly centered around compatibility for mixed page size reporting. This patch side steps all of this by
only handling the non mixed case in the simplest possible way. It also avoids a problem introduced with v2 that page sizes for mappings with no pages were incorrectly reported.
--- fs/proc/task_mmu.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/proc/task_mmu.c +11 -1
@@ -1371,6 +1371,7 @@ static int show_smap(struct seq_file *m, void *v) {struct vm_area_struct *vma = v;struct mem_size_stats mss = {}; +unsigned ps;smap_gather_stats (vma, &mss,0 );
@@ -1378,7 +1379,16 @@ static int show_smap(struct seq_file *m, void *v)SEQ_PUT_DEC ("Size: " , vma->vm_end - vma->vm_start);SEQ_PUT_DEC (" kB\nKernelPageSize: " ,vma_kernel_pagesize (vma)); -SEQ_PUT_DEC (" kB\nMMUPageSize: " ,vma_mmu_pagesize (vma)); + ps =vma_mmu_pagesize (vma); +/* +* When the mapping is only PMD THP report the correct page size. +* When multiple pages are there the user has to figure it out +* from other fields. +*/ +if (mss.shmem_thp + mss.file_thp + mss.anonymous_thp == mss.resident && + mss.resident) + ps =HPAGE_PMD_SIZE ; +SEQ_PUT_DEC (" kB\nMMUPageSize: " , ps);seq_puts (m," kB\n" );__show_smap (m, &mss, false);
Signature · 1 line
2.53.0
Why do you keep not CCing people from v1/v2 discussions? David said that already on v2. It seems rather rude to me.
Quoted 11 lines · Andi Kleen
When a smaps mapping is only PMD mappings report the PMD page size for MMUPageSize instead of the base page size.
This is a revised version of an earlier patch that tried to report multiple page sizes, but there were many objections mainly centered around compatibility for mixed page size reporting. This patch side steps all of this by
only handling the non mixed case in the simplest possible way. It also avoids a problem introduced with v2 that page sizes for mappings with no pages were incorrectly reported.
Quoted 1 line
Signed-off-by Andi Kleen <[email protected]>
Will this be useful in practice or just confusing? There can be e.g. misaligned mappings, or other reasons why there won't be 100% THP coverage. This all or nothing value (IIUC) seems inferior to the counters we have that say how much is pmd mapped, so I'm not really sure it's worth changing this.
Quoted 34 lines
--- fs/proc/task_mmu.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)fs/proc/task_mmu.c +11
-1@@ -1371,6 +1371,7 @@ static int show_smap(struct seq_file *m, void *v) {struct vm_area_struct *vma = v;struct mem_size_stats mss = {}; +unsigned ps;smap_gather_stats (vma, &mss,0 );@@ -1378,7 +1379,16 @@ static int show_smap(struct seq_file *m, void *v)SEQ_PUT_DEC ("Size: " , vma->vm_end - vma->vm_start);SEQ_PUT_DEC (" kB\nKernelPageSize: " ,vma_kernel_pagesize (vma)); -SEQ_PUT_DEC (" kB\nMMUPageSize: " ,vma_mmu_pagesize (vma)); + ps =vma_mmu_pagesize (vma); +/* +* When the mapping is only PMD THP report the correct page size. +* When multiple pages are there the user has to figure it out +* from other fields. +*/ +if (mss.shmem_thp + mss.file_thp + mss.anonymous_thp == mss.resident && + mss.resident) + ps =HPAGE_PMD_SIZE ; +SEQ_PUT_DEC (" kB\nMMUPageSize: " , ps);seq_puts (m," kB\n" );__show_smap (m, &mss, false);
Quoted 15 lines · Vlastimil Babka
Why do you keep not CCing people from v1/v2 discussions? David said that already on v2. It seems rather rude to me.
Quoted 11 lines · Andi Kleen
When a smaps mapping is only PMD mappings report the PMD page size for MMUPageSize instead of the base page size.
This is a revised version of an earlier patch that tried to report multiple page sizes, but there were many objections mainly centered around compatibility for mixed page size reporting. This patch side steps all of this by
only handling the non mixed case in the simplest possible way. It also avoids a problem introduced with v2 that page sizes for mappings with no pages were incorrectly reported.
Quoted 3 lines
Quoted 1 line
Signed-off-by Andi Kleen <[email protected]>Will this be useful in practice or just confusing? There can be e.g.
It might have saved me some wasted time.
I found the current situation confusing!
Quoted 2 lines
misaligned mappings, or other reasons why there won't be 100% THP coverage. This all or nothing value (IIUC) seems inferior to the
s/nothing/4K like what's there today/
Yes probably multiple page sizes would be better, but I'm not reopening that discussion now.
Quoted 2 lines
counters we have that say how much is pmd mapped, so I'm not really sure it's worth changing this.
The other counters still exist of course.
I don't see how there can be confusion if we report the correct page size if the mapping is only that page size vs a page size that is not used at all.
-Andi
Quoted 15 lines · Vlastimil Babka
Why do you keep not CCing people from v1/v2 discussions? David said that already on v2. It seems rather rude to me.
Quoted 11 lines · Andi Kleen
When a smaps mapping is only PMD mappings report the PMD page size for MMUPageSize instead of the base page size.
This is a revised version of an earlier patch that tried to report multiple page sizes, but there were many objections mainly centered around compatibility for mixed page size reporting. This patch side steps all of this by
only handling the non mixed case in the simplest possible way. It also avoids a problem introduced with v2 that page sizes for mappings with no pages were incorrectly reported.
Quoted 7 lines
Quoted 1 line
Signed-off-by Andi Kleen <[email protected]>Will this be useful in practice or just confusing? There can be e.g. misaligned mappings, or other reasons why there won't be 100% THP coverage. This all or nothing value (IIUC) seems inferior to the counters we have that say how much is pmd mapped, so I'm not really sure it's worth changing this.
My opinion on this remains unchanged.
Not CCing me once more is questionable and makes me want to recommend Andi to work on different parts of the kernel.
I sent a doc update to clarify this. Won't make everybody happy, but we can't turn back time.
Signature · 3 lines
Cheers, David
Lorenzo Stoakes (Oracle)
maintainerQuoted 18 lines · David Hildenbrand (Arm)
Quoted 17 lines · Vlastimil Babka
Why do you keep not CCing people from v1/v2 discussions? David said that already on v2. It seems rather rude to me.
Quoted 12 lines · Andi Kleen
When a smaps mapping is only PMD mappings report the PMD page size for MMUPageSize instead of the base page size.
This is a revised version of an earlier patch that tried to report multiple page sizes, but there were many objections mainly centered around compatibility for mixed page size reporting. This patch side steps all of this by
only handling the non mixed case in the simplest possible way. It also avoids a problem introduced with v2 that page sizes for mappings with no pages were incorrectly reported.Signed-off-by Andi Kleen <[email protected]>
Quoted 7 lines
Quoted 5 lines
Will this be useful in practice or just confusing? There can be e.g. misaligned mappings, or other reasons why there won't be 100% THP coverage. This all or nothing value (IIUC) seems inferior to the counters we have that say how much is pmd mapped, so I'm not really sure it's worth changing this.
My opinion on this remains unchanged.
Mine also.
Quoted 3 lines
Not CCing me once more is questionable and makes me want to recommend Andi to work on different parts of the kernel.
Andi - I'm genuinely concerned that you're doing this on purpose here - especially since you ignored that part of Vlastimil's reply and ignored previous feedback about failing to cc- on more than one occasion.
Responding to negative technical feedback by being rude and dismissive then (seemingly) intentionally trying to circumvent the review by failing to cc- those who commented is completely unacceptable.
Sadly I have to join David in suggesting you find other parts of the kernel to work on.
Quoted 3 lines
I sent a doc update to clarify this. Won't make everybody happy, but we can't turn back time.
Thanks, will take a look!
Quoted 6 lines
--
Cheers,David
Cheers, Lorenzo