From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id AF88C7DF87 for ; Mon, 21 May 2018 14:52:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752879AbeEUOw0 (ORCPT ); Mon, 21 May 2018 10:52:26 -0400 Received: from foss.arm.com ([217.140.101.70]:51922 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752735AbeEUOwW (ORCPT ); Mon, 21 May 2018 10:52:22 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 94CE580D; Mon, 21 May 2018 07:52:21 -0700 (PDT) Received: from localhost (e105922-lin.cambridge.arm.com [10.1.206.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 167433F577; Mon, 21 May 2018 07:52:21 -0700 (PDT) From: Punit Agrawal To: TSUKADA Koutaro Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Jonathan Corbet , "Luis R. Rodriguez" , Kees Cook , Andrew Morton , Roman Gushchin , David Rientjes , Mike Kravetz , "Aneesh Kumar K.V" , Naoya Horiguchi , Anshuman Khandual , Marc-Andre Lureau , Dan Williams , Vlastimil Babka , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org Subject: Re: [PATCH v2 0/7] mm: pages for hugetlb's overcommit may be able to charge to memcg References: Date: Mon, 21 May 2018 15:52:19 +0100 In-Reply-To: (TSUKADA Koutaro's message of "Fri, 18 May 2018 13:27:27 +0900") Message-ID: <871se5ysbg.fsf@e105922-lin.cambridge.arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org Hi Tsukada, I was staring at memcg code to better understand your changes and had the below thought. TSUKADA Koutaro writes: [...] > In this patch-set, introduce the charge_surplus_huge_pages(boolean) to > struct hstate. If it is true, it charges to the memory cgroup to which the > task that obtained surplus hugepages belongs. If it is false, do nothing as > before, and the default value is false. The charge_surplus_huge_pages can > be controlled procfs or sysfs interfaces. Instead of tying the surplus huge page charging control per-hstate, could the control be made per-memcg? This can be done by introducing a per-memory controller file in sysfs (memory.charge_surplus_hugepages?) that indicates whether surplus hugepages are to be charged to the controller and forms part of the total limit. IIUC, the limit already accounts for page and swap cache pages. This would allow the control to be enabled per-cgroup and also keep the userspace control interface in one place. As said earlier, I'm not familiar with memcg so the above might not be a feasible but think it'll lead to a more coherent user interface. Hopefully, more knowledgeable folks on the thread can chime in. Thanks, Punit > Since THP is very effective in environments with kernel page size of 4KB, > such as x86, there is no reason to positively use HugeTLBfs, so I think > that there is no situation to enable charge_surplus_huge_pages. However, in > some distributions such as arm64, the page size of the kernel is 64KB, and > the size of THP is too huge as 512MB, making it difficult to use. HugeTLBfs > may support multiple huge page sizes, and in such a special environment > there is a desire to use HugeTLBfs. > > The patch set is for 4.17.0-rc3+. I don't know whether patch-set are > acceptable or not, so I just done a simple test. > > Thanks, > Tsukada > > TSUKADA Koutaro (7): > hugetlb: introduce charge_surplus_huge_pages to struct hstate > hugetlb: supports migrate charging for surplus hugepages > memcg: use compound_order rather than hpage_nr_pages > mm, sysctl: make charging surplus hugepages controllable > hugetlb: add charge_surplus_hugepages attribute > Documentation, hugetlb: describe about charge_surplus_hugepages > memcg: supports movement of surplus hugepages statistics > > Documentation/vm/hugetlbpage.txt | 6 + > include/linux/hugetlb.h | 4 + > kernel/sysctl.c | 7 + > mm/hugetlb.c | 148 +++++++++++++++++++++++++++++++++++++++ > mm/memcontrol.c | 109 +++++++++++++++++++++++++++- > 5 files changed, 269 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html