2020년 5월 21일 (목) 오전 8:26, Johannes Weiner <hannes@xxxxxxxxxxx>님이 작성: > > We activate cache refaults with reuse distances in pages smaller than > the size of the total cache. This allows new pages with competitive > access frequencies to establish themselves, as well as challenge and > potentially displace pages on the active list that have gone cold. > > However, that assumes that active cache can only replace other active > cache in a competition for the hottest memory. This is not a great > default assumption. The page cache might be thrashing while there are > enough completely cold and unused anonymous pages sitting around that > we'd only have to write to swap once to stop all IO from the cache. > > Activate cache refaults when their reuse distance in pages is smaller > than the total userspace workingset, including anonymous pages. Hmm... I'm not sure the correctness of this change. IIUC, this patch leads to more activations in the file list and more activations here will challenge the anon list since rotation ratio for the file list will be increased. However, this change breaks active/inactive concept of the file list. active/inactive separation is implemented by in-list refault distance. anon list size has no direct connection with refault distance of the file list so using anon list size to detect workingset for file page breaks the concept. My suspicion is started by this counter example. Environment: anon: 500 MB (so hot) / 500 MB (so hot) file: 50 MB (hot) / 50 MB (cold) Think about the situation that there is periodical access to other file (100 MB) with low frequency (refault distance is 500 MB) Without your change, this periodical access doesn't make thrashing for cached active file page since refault distance of periodical access is larger than the size of the active file list. However, with your change, it causes thrashing on the file list. In fact, I'm not sure that I'm thinking correctly. It's very complicated for me. :) Please let me know if there is a missing piece. Thanks.