From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752708AbcGVHtS (ORCPT ); Fri, 22 Jul 2016 03:49:18 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35317 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751648AbcGVHtQ (ORCPT ); Fri, 22 Jul 2016 03:49:16 -0400 Date: Fri, 22 Jul 2016 09:49:13 +0200 From: Michal Hocko To: Zhou Chengming Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, vdavydov@virtuozzo.com, riel@redhat.com, guohanjun@huawei.com Subject: Re: [PATCH] update sc->nr_reclaimed after each shrink_slab Message-ID: <20160722074913.GD794@dhcp22.suse.cz> References: <1469159010-5636-1-git-send-email-zhouchengming1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1469159010-5636-1-git-send-email-zhouchengming1@huawei.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 22-07-16 11:43:30, Zhou Chengming wrote: > In !global_reclaim(sc) case, we should update sc->nr_reclaimed after each > shrink_slab in the loop. Because we need the correct sc->nr_reclaimed > value to see if we can break out. Does this actually change anything? Maybe I am missing something but try_to_free_mem_cgroup_pages which is the main entry for the memcg reclaim doesn't set reclaim_state. I don't remember why... Vladimir? Have you observed any issues and this patch fixes it or this is just motivated by the code inspection? > Signed-off-by: Zhou Chengming > --- > mm/vmscan.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index c4a2f45..47133c3 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2405,6 +2405,11 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc, > memcg, sc->nr_scanned - scanned, > lru_pages); > > + if (!global_reclaim(sc) && reclaim_state) { > + sc->nr_reclaimed += reclaim_state->reclaimed_slab; > + reclaim_state->reclaimed_slab = 0; > + } > + > /* Record the group's reclaim efficiency */ > vmpressure(sc->gfp_mask, memcg, false, > sc->nr_scanned - scanned, > -- > 1.7.7 > -- Michal Hocko SUSE Labs