Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965235AbcDYVw0 (ORCPT ); Mon, 25 Apr 2016 17:52:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56749 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965020AbcDYVwZ (ORCPT ); Mon, 25 Apr 2016 17:52:25 -0400 Date: Mon, 25 Apr 2016 14:52:23 -0700 From: Andrew Morton To: David Rientjes Cc: Michal Hocko , Nikolay Borisov , Johannes Weiner , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch v2] mm, hugetlb_cgroup: round limit_in_bytes down to hugepage size Message-Id: <20160425145223.22617d4c1f12b0f7f4702988@linux-foundation.org> In-Reply-To: References: <5704BA37.2080508@kyup.com> <5704BBBF.8040302@kyup.com> <20160407125145.GD32755@dhcp22.suse.cz> <20160415132451.GL32377@dhcp22.suse.cz> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1896 Lines: 47 On Mon, 18 Apr 2016 14:23:58 -0700 (PDT) David Rientjes wrote: > On Fri, 15 Apr 2016, Michal Hocko wrote: > > > > > > +static void hugetlb_cgroup_init(struct hugetlb_cgroup *h_cgroup, > > > > > + struct hugetlb_cgroup *parent_h_cgroup) > > > > > +{ > > > > > + int idx; > > > > > + > > > > > + for (idx = 0; idx < HUGE_MAX_HSTATE; idx++) { > > > > > + struct page_counter *counter = &h_cgroup->hugepage[idx]; > > > > > + struct page_counter *parent = NULL; > > > > > + unsigned long limit; > > > > > + int ret; > > > > > + > > > > > + if (parent_h_cgroup) > > > > > + parent = &parent_h_cgroup->hugepage[idx]; > > > > > + page_counter_init(counter, parent); > > > > > + > > > > > + limit = round_down(PAGE_COUNTER_MAX, > > > > > + 1 << huge_page_order(&hstates[idx])); > > > > > + ret = page_counter_limit(counter, limit); > > > > > + VM_BUG_ON(ret); > > > > > + } > > > > > +} > > > > > > > > I fail to see the point for this. Why would want to round down > > > > PAGE_COUNTER_MAX? It will never make a real difference. Or am I missing > > > > something? > > > > > > Did you try the patch? > > > > > > If we're rounding down the user value, it makes sense to be consistent > > > with the upper bound default to specify intent. > > > > The point I've tried to raise is why do we care and add a code if we can > > never reach that value? Does actually anybody checks for the alignment. > > If the user modifies the value successfully, it can never be restored to > the default since the write handler rounds down. It's a matter of > consistency for a long-term maintainable kernel and prevents bug reports. Can we please get the above reasoning into the changelog? Also, the runtime effects of the patch are unclear - "not possible to charge partial hugepages" sounds serious, but there's no cc:stable. Some clarification there also please.