On Thu 05-11-20 22:16:10, Yafang Shao wrote: > On Thu, Nov 5, 2020 at 9:35 PM Michal Hocko <mhocko@xxxxxxxx> wrote: > > > > On Thu 05-11-20 21:10:12, Yafang Shao wrote: > > > The memory utilization (Used / Total) is used to monitor the memory > > > pressure by us. If it is too high, it means the system may be OOM sooner > > > or later when swap is off, then we will make adjustment on this system. > > > > > > However, this method is broken since MADV_FREE is introduced, because > > > these lazily free anonymous can be reclaimed under memory pressure while > > > they are still accounted in NR_ANON_MAPPED. > > > > > > Furthermore, since commit f7ad2a6cb9f7 ("mm: move MADV_FREE pages into > > > LRU_INACTIVE_FILE list"), these lazily free anonymous pages are moved > > > from anon lru list into file lru list. That means > > > (Inactive(file) + Active(file)) may be much larger than Cached in > > > /proc/meminfo. That makes our users confused. > > > > > > So we'd better account the lazily freed anonoymous pages in > > > NR_FILE_PAGES as well. > > > > Can you simply subtract lazyfree pages in the userspace? > > Could you pls. tell me how to subtract lazyfree pages in the userspace? > Pls. note that we can't use (pglazyfree - pglazyfreed) because > pglazyfreed is only counted in the regular reclaim path while the > process exit path is not counted, that means we have to introduce > another counter like LazyPage.... OK, I see your concern. I thought that we do update counters on a regular unmap. I do not see any reason why we shouldn't. It is indeed bad that we cannot tell the current number of lazy free pages by no means. Was this deliberate Minchan? -- Michal Hocko SUSE Labs