From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932174AbbJ0Kbt (ORCPT ); Tue, 27 Oct 2015 06:31:49 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:34238 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932139AbbJ0Kbq (ORCPT ); Tue, 27 Oct 2015 06:31:46 -0400 Date: Tue, 27 Oct 2015 11:31:43 +0100 From: Michal Hocko To: Ben Hutchings Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Shaohua Li , Johannes Weiner , Andrew Morton , Linus Torvalds Subject: Re: [PATCH 4.2 25/54] memcg: convert threshold to bytes Message-ID: <20151027103142.GE9891@dhcp22.suse.cz> References: <20151023174519.086915553@linuxfoundation.org> <20151023174519.845601158@linuxfoundation.org> <1445665618.2395.12.camel@decadent.org.uk> <20151025163210.GA10655@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20151025163210.GA10655@dhcp22.suse.cz> 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 On Sun 25-10-15 17:32:10, Michal Hocko wrote: > On Sat 24-10-15 14:46:58, Ben Hutchings wrote: > [...] > > > --- a/mm/memcontrol.c > > > +++ b/mm/memcontrol.c > > > @@ -3687,6 +3687,7 @@ static int __mem_cgroup_usage_register_e > > >  > > ret = page_counter_memparse(args, "-1", &threshold); > > >  > > if (ret) > > >  > > > return ret; > > > +> > threshold <<= PAGE_SHIFT; > > >   > > >  > > mutex_lock(&memcg->thresholds_lock); > > >   > > > > mem_cgroup_usage() returns a u64 and I think that the types of > > threshold and mem_cgroup_threshold::threshold also need be changed to > > u64 to avoid overflow on large 32-bit systems. > > You are absolutely right! I have compltely missed that 3e32cb2e0a12 has > changed the type as well. Should have noticed that during the review. > > The whole thing is just way too confusing. All the tracking is done in > page units yet tresholds are in bytes. This only calls for troubles. The > patch below simply turns thresholds to page units as well. I hope I > haven't screwed anything, I didn't get to more than compile test it. OK, I've tested it and it seems working as expected. I will repost to the linux-mm mailing list. -- Michal Hocko SUSE Labs