Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753416AbbKXQjD (ORCPT ); Tue, 24 Nov 2015 11:39:03 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:32993 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750934AbbKXQjB (ORCPT ); Tue, 24 Nov 2015 11:39:01 -0500 Date: Tue, 24 Nov 2015 17:38:58 +0100 From: Michal Hocko To: Vladimir Davydov Cc: Andrew Morton , Johannes Weiner , Tejun Heo , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] memcg: fix memory.high target Message-ID: <20151124163857.GL29472@dhcp22.suse.cz> References: <1448281351-15103-1-git-send-email-vdavydov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1448281351-15103-1-git-send-email-vdavydov@virtuozzo.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1686 Lines: 47 On Mon 23-11-15 15:22:31, Vladimir Davydov wrote: > When the memory.high threshold is exceeded, try_charge() schedules a > task_work to reclaim the excess. The reclaim target is set to the number > of pages requested by try_charge(). This is wrong, because try_charge() > usually charges more pages than requested (batch > nr_pages) in order to > refill per cpu stocks. As a result, a process in a cgroup can easily > exceed memory.high significantly when doing a lot of charges w/o > returning to userspace (e.g. reading a file in big chunks). > > Fix this issue by assuring that when exceeding memory.high a process > reclaims as many pages as were actually charged (i.e. batch). Good point. This will not affect the single page load because the reclaim is done in SWAP_CLUSTER_MAX chunks anyway. > Signed-off-by: Vladimir Davydov Acked-by: Michal Hocko > --- > mm/memcontrol.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 648cc9f02437..06c476ab0f2c 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -2133,7 +2133,7 @@ done_restock: > */ > do { > if (page_counter_read(&memcg->memory) > memcg->high) { > - current->memcg_nr_pages_over_high += nr_pages; > + current->memcg_nr_pages_over_high += batch; > set_notify_resume(current); > break; > } > -- > 2.1.4 -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/