On Wed, Nov 14, 2012 at 03:20:08AM +0100, Paolo Bonzini wrote: > Il 14/11/2012 03:14, Isaku Yamahata ha scritto: > >> > Identifying ballooned zero pages is useful, because those cause the > >> > clear_page calls in the kernel even in a guest that has been running for > >> > a while. > >> > > >> > But a generic solution doesn't really matter, because is_dup_page and > >> > clear_page shouldn't really be in the profile in practice, except in > >> > microbenchmarks. > > I guess mincore(2) can be used as easy way to detect non-mapped page. > > This is just implementation detail anyway. > > Doesn't work if the page is swapped, doesn't it?
Ah, I meant if page is in memory, we can skip is_dup_page for that page. Only check pages that is not-mapped or swapped. If more detailed info is needed, /proc/<pid>/pagemap would be used. > But I wonder if the clear_page occurrences are because of the problem > described recently on LWN (http://lwn.net/Articles/517465/), and so > really more of a kernel bug than anything else. > > Paolo > -- yamahata