The patch titled Subject: tools-adding-support-for-idle-page-tracking-to-tool-fix-2 has been added to the -mm tree. Its filename is tools-adding-support-for-idle-page-tracking-to-tool-fix-2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/tools-adding-support-for-idle-page-tracking-to-tool-fix-2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/tools-adding-support-for-idle-page-tracking-to-tool-fix-2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Christian Hansen <chansen3@xxxxxxxxx> Subject: tools-adding-support-for-idle-page-tracking-to-tool-fix-2 reorganize mark_page_idle() logic, add docs Link: http://lkml.kernel.org/r/20180706172237.21691-1-chansen3@xxxxxxxxx Signed-off-by: Christian Hansen <chansen3@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/admin-guide/mm/idle_page_tracking.rst | 5 ++ tools/vm/page-types.c | 18 ++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff -puN Documentation/admin-guide/mm/idle_page_tracking.rst~tools-adding-support-for-idle-page-tracking-to-tool-fix-2 Documentation/admin-guide/mm/idle_page_tracking.rst --- a/Documentation/admin-guide/mm/idle_page_tracking.rst~tools-adding-support-for-idle-page-tracking-to-tool-fix-2 +++ a/Documentation/admin-guide/mm/idle_page_tracking.rst @@ -65,6 +65,11 @@ workload one should: are not reclaimable, he or she can filter them out using ``/proc/kpageflags``. +The page-types tool in the tools/vm directory can be used to assist in this. +If the tool is run initially with the appropriate option, it will mark all the +queried pages as idle. Subsequent runs of the tool can then show which pages have +their idle flag cleared in the interim. + See :ref:`Documentation/admin-guide/mm/pagemap.rst <pagemap>` for more information about ``/proc/pid/pagemap``, ``/proc/kpageflags``, and ``/proc/kpagecgroup``. diff -puN tools/vm/page-types.c~tools-adding-support-for-idle-page-tracking-to-tool-fix-2 tools/vm/page-types.c --- a/tools/vm/page-types.c~tools-adding-support-for-idle-page-tracking-to-tool-fix-2 +++ a/tools/vm/page-types.c @@ -597,15 +597,21 @@ static int mark_page_idle(unsigned long static uint64_t buf; int len; - if ((offset / 64 != off / 64) && buf != 0) { - len = pwrite(page_idle_fd, &buf, 8, 8 * (off / 64)); - if (len < 0) { - perror("mark page idle"); - return len; - } + if ((offset / 64 == off / 64) || buf == 0) { + buf |= 1UL << (offset % 64); + off = offset; + return 0; } + + len = pwrite(page_idle_fd, &buf, 8, 8 * (off / 64)); + if (len < 0) { + perror("mark page idle"); + return len; + } + buf = 1UL << (offset % 64); off = offset; + return 0; } _ Patches currently in -mm which might be from chansen3@xxxxxxxxx are tools-modifying-page-types-to-include-shared-map-counts.patch tools-modifying-page-types-to-include-shared-map-counts-fix.patch tools-adding-support-for-idle-page-tracking-to-tool.patch tools-adding-support-for-idle-page-tracking-to-tool-fix-2.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html