perf kmem: Support sort keys on page analysis

Add new sort keys for page: page, order, mtype, gfp - existing
'bytes', 'hit' and 'callsite' sort keys also work for page.  Note that
-s/--sort option should be preceded by either of --slab or --page
option to determine where the sort keys applies.

Now it properly groups and sorts allocation stats - so same
page/caller with different order/mtype/gfp will be printed on a
different line.

  # perf kmem stat --page --caller -l 10 -s order,hit

  --------------------------------------------------------------------------------------------
   Total_alloc/Per | Hit      | Order | Migrate type | GFP flag | Callsite
  --------------------------------------------------------------------------------------------
       65536/16384 |        4 |     2 |  RECLAIMABLE | 00285250 | new_slab
    51347456/4096  |    12536 |     0 |      MOVABLE | 0102005a | __page_cache_alloc
       53248/4096  |       13 |     0 |    UNMOVABLE | 002084d0 | pte_alloc_one
       40960/4096  |       10 |     0 |      MOVABLE | 000280da | handle_mm_fault
       28672/4096  |        7 |     0 |    UNMOVABLE | 000000d0 | __pollwait
       20480/4096  |        5 |     0 |      MOVABLE | 000200da | do_wp_page
       20480/4096  |        5 |     0 |      MOVABLE | 000200da | do_cow_fault
       16384/4096  |        4 |     0 |    UNMOVABLE | 00000200 | __tlb_remove_page
       16384/4096  |        4 |     0 |    UNMOVABLE | 000084d0 | __pmd_alloc
        8192/4096  |        2 |     0 |    UNMOVABLE | 000084d0 | __pud_alloc
   ...             | ...      | ...   | ...          | ...      | ...
  --------------------------------------------------------------------------------------------

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2 files changed