Message ID | 1582175513-22601-2-git-send-email-iamjoonsoo.kim@lge.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | workingset protection/detection on the anonymous LRU list | expand |
On Thu, Feb 20, 2020 at 02:11:45PM +0900, js1304@gmail.com wrote: > From: Joonsoo Kim <iamjoonsoo.kim@lge.com> > > Current implementation of LRU management for anonymous page has some > problems. Most important one is that it doesn't protect the workingset, > that is, pages on the active LRU list. Although, this problem will be > fixed in the following patchset, the preparation is required and > this patch does it. > > What following patchset does is to restore workingset protection. In this > case, newly created or swap-in pages are started their lifetime on the > inactive list. If inactive list is too small, there is not enough chance > to be referenced and the page cannot become the workingset. > > In order to provide enough chance to the newly anonymous pages, this patch > makes active/inactive LRU ratio as 1:1. Patch 8/9 is a revert of this patch. I assume you did this for the series to be bisectable and partially revertable, but I'm not sure keeping only the first and second patch would be safe: they reduce workingset protection quite dramatically on their own (on a 10G system from 90% of RAM to 50% e.g.) and likely cause regressions. So while patch 2 is probably a lot better with patch 1 than without, it seems a bit unnecessary since we cannot keep patch 2 on its own. We need the rest of the series to make these changes. On the other hand, the patch is small and obviously correct. So no strong feelings either way. > Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
2020년 3월 12일 (목) 오후 11:47, Johannes Weiner <hannes@cmpxchg.org>님이 작성: > > On Thu, Feb 20, 2020 at 02:11:45PM +0900, js1304@gmail.com wrote: > > From: Joonsoo Kim <iamjoonsoo.kim@lge.com> > > > > Current implementation of LRU management for anonymous page has some > > problems. Most important one is that it doesn't protect the workingset, > > that is, pages on the active LRU list. Although, this problem will be > > fixed in the following patchset, the preparation is required and > > this patch does it. > > > > What following patchset does is to restore workingset protection. In this > > case, newly created or swap-in pages are started their lifetime on the > > inactive list. If inactive list is too small, there is not enough chance > > to be referenced and the page cannot become the workingset. > > > > In order to provide enough chance to the newly anonymous pages, this patch > > makes active/inactive LRU ratio as 1:1. > > Patch 8/9 is a revert of this patch. I assume you did this for the > series to be bisectable and partially revertable, but I'm not sure > keeping only the first and second patch would be safe: they reduce > workingset protection quite dramatically on their own (on a 10G system > from 90% of RAM to 50% e.g.) and likely cause regressions. > > So while patch 2 is probably a lot better with patch 1 than without, Yes, it is what I intended. > it seems a bit unnecessary since we cannot keep patch 2 on its own. We > need the rest of the series to make these changes. Yes, you're right. > On the other hand, the patch is small and obviously correct. So no > strong feelings either way. Okay. I will keep the patches since I think that these patches will help someone who want to understand the LRU management. > > Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> > > Reviewed-by: Johannes Weiner <hannes@cmpxchg.org> Thanks!
diff --git a/mm/vmscan.c b/mm/vmscan.c index 572fb17..e772f3f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2217,7 +2217,7 @@ static bool inactive_is_low(struct lruvec *lruvec, enum lru_list inactive_lru) active = lruvec_page_state(lruvec, NR_LRU_BASE + active_lru); gb = (inactive + active) >> (30 - PAGE_SHIFT); - if (gb) + if (gb && is_file_lru(inactive_lru)) inactive_ratio = int_sqrt(10 * gb); else inactive_ratio = 1;