mm/vmscan.c: add a new member reclaim_state in struct shrink_control
Patch series "mm/vmscan: calculate reclaimed slab in all reclaim paths". This patchset is to fix the issues in doing shrink slab. There're six different reclaim paths by now, - kswapd reclaim path - node reclaim path - hibernate preallocate memory reclaim path - direct reclaim path - memcg reclaim path - memcg softlimit reclaim path The slab caches reclaimed in these paths are only calculated in the above three paths. The issues are detailed explained in patch #2. We should calculate the reclaimed slab caches in every reclaim path. In order to do it, the struct reclaim_state is placed into the struct shrink_control. In node reclaim path, there'is another issue about shrinking slab, which is adressed in "mm/vmscan: shrink slab in node reclaim" (https://lore.kernel.org/linux-mm/1559874946-22960-1-git-send-email-laoar.shao@gmail.com/). This patch (of 2): The struct reclaim_state is used to record how many slab caches are reclaimed in one reclaim path. The struct shrink_control is used to control one reclaim path. So we'd better put reclaim_state into shrink_control. [laoar.shao@gmail.com: remove reclaim_state assignment from __perform_reclaim()] Link: http://lkml.kernel.org/r/1561381582-13697-1-git-send-email-laoar.shao@gmail.com Link: http://lkml.kernel.org/r/1561112086-6169-2-git-send-email-laoar.shao@gmail.com Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: Mel Gorman <mgorman@techsingularity.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
766a4c19d8
commit
e5ca8071fe
@@ -4102,7 +4102,6 @@ static int
|
||||
__perform_reclaim(gfp_t gfp_mask, unsigned int order,
|
||||
const struct alloc_context *ac)
|
||||
{
|
||||
struct reclaim_state reclaim_state;
|
||||
int progress;
|
||||
unsigned int noreclaim_flag;
|
||||
unsigned long pflags;
|
||||
@@ -4114,13 +4113,10 @@ __perform_reclaim(gfp_t gfp_mask, unsigned int order,
|
||||
psi_memstall_enter(&pflags);
|
||||
fs_reclaim_acquire(gfp_mask);
|
||||
noreclaim_flag = memalloc_noreclaim_save();
|
||||
reclaim_state.reclaimed_slab = 0;
|
||||
current->reclaim_state = &reclaim_state;
|
||||
|
||||
progress = try_to_free_pages(ac->zonelist, order, gfp_mask,
|
||||
ac->nodemask);
|
||||
|
||||
current->reclaim_state = NULL;
|
||||
memalloc_noreclaim_restore(noreclaim_flag);
|
||||
fs_reclaim_release(gfp_mask);
|
||||
psi_memstall_leave(&pflags);
|
||||
|
Reference in New Issue
Block a user