Re: [PATCH 0/3] idle memory tracking

From: Vladimir Davydov
Date: Tue Mar 24 2015 - 03:46:02 EST


On Wed, Mar 18, 2015 at 11:44:33PM +0300, Vladimir Davydov wrote:
> Usage:
>
> 1. Write 1 to /proc/sys/vm/set_idle.
>
> This will set the IDLE flag for all user pages. The IDLE flag is cleared
> when the page is read or the ACCESS/YOUNG bit is cleared in any PTE pointing
> to the page. It is also cleared when the page is freed.
>
> 2. Wait some time.
>
> 3. Write 6 to /proc/PID/clear_refs for each PID of interest.
>
> This will clear the IDLE flag for recently accessed pages.
>
> 4. Count the number of idle pages as reported by /proc/kpageflags. One may use
> /proc/PID/pagemap and/or /proc/kpagecgroup to filter pages that belong to a
> certain application/container.

Any more thoughts on this? I am particularly interested in the user
interface. I think that /proc/kpagecgroup is OK, but I have my
reservations about using /proc/sys/vm/set_idle and /proc/PID/clear_refs
for setting and clearing the idle flag. The point is it is impossible to
scan memory for setting/clearing page idle flags in the background with
some predefined rate - one has to scan it all at once, which might
result in CPU load spikes on huge machines with TBs of RAM. May be, we'd
better introduce /proc/sys/vm/{set_idle,clear_refs_idle}, which would
receive pfn range to set/clear idle flags?

Any thoughts/ideas are more than welcome.

Thanks,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/