@@ -27,6 +27,9 @@
#define SEQ_PUT_DEC(str, val) \
seq_put_decimal_ull_width(m, str, (val) << (PAGE_SHIFT-10), 8)
+
+int only_print_head_pfn;
+
void task_mem(struct seq_file *m, struct mm_struct *mm)
{
unsigned long text, lib, swap, anon, file, shmem;
@@ -1308,7 +1311,7 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
flags |= PM_SOFT_DIRTY;
if (pm->show_pfn)
frame = pmd_pfn(pmd) +
- ((addr & ~PMD_MASK) >> PAGE_SHIFT);
+ (only_print_head_pfn?0:((addr & ~PMD_MASK) >> PAGE_SHIFT));
}
#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
else if (is_swap_pmd(pmd)) {
@@ -1394,7 +1397,7 @@ static int pagemap_pud_range(pud_t *pudp, unsigned long addr, unsigned long end,
flags |= PM_SOFT_DIRTY;
if (pm->show_pfn)
frame = pud_pfn(pud) +
- ((addr & ~PMD_MASK) >> PAGE_SHIFT);
+ (only_print_head_pfn?0:((addr & ~PUD_MASK) >> PAGE_SHIFT));
}
if (page && page_mapcount(page) == 1)
@@ -122,6 +122,8 @@ extern int vma_no_repeat_defrag;
extern int num_breakout_chunks;
extern int defrag_size_threshold;
+extern int only_print_head_pfn;
+
/* Constants used for minimum and maximum */
#ifdef CONFIG_LOCKUP_DETECTOR
static int sixty = 60;
@@ -1750,6 +1752,15 @@ static struct ctl_table vm_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero,
},
+ {
+ .procname = "only_print_head_pfn",
+ .data = &only_print_head_pfn,
+ .maxlen = sizeof(only_print_head_pfn),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = &zero,
+ .extra2 = &one,
+ },
{ }
};