Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1167352ybl; Wed, 29 Jan 2020 16:45:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzCVJGgAL0GU8pC6bB/euZqyzrb0NH/TYFHU7OzSJLMiQHvZEqo2qBTLg02iXeTKVyh/GSI X-Received: by 2002:a05:6830:1198:: with SMTP id u24mr1498167otq.215.1580345113703; Wed, 29 Jan 2020 16:45:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580345113; cv=none; d=google.com; s=arc-20160816; b=guytJg0ABhmD619o+VwXRCj1Kw2bOJzVCTAF42cBFKPe1PRuX0CcgH3x6Ai9zhGops qp3YUDaJjk7IiNps1y5U8nsKvwfu/NugNyuyKsi1MTB3Yb08d7lTHiv9JVQQIP877ur2 dzkk2m2eugQzgkFCrOjvmWeEfr8/39ms4lOa7RnWH9ieDlYsb5763rob4ajqlxvGbb6W HePj3MSPP+64HcQCzU3NZu/ak/ixvDojvFLgKovrQuT3vCoDNJ4Weulno31mKD2L1cJc 1jBL01e0G0244H8UYIh/VZuyZ64Nz7GnXLTbPgH1InqCK5y+jPi8y5iPdyBkfM0SjZya eUnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=HxaL1diqaEv286OlhDwXeFz8SznwXgpMh0T9XvkcS/4=; b=LxkIXw3KtIdvgJ94UyhMriI6NOGS17Iym06LqSZm2RfxKWk5lVZvPP8CAWufMritxM zLq8iNnQ923NZBA0cIudph/v0X8731QM7rYrt0jaD047TS3HnKXPlUcPezXzwq2mhzD4 rdhz/v9T1+WcuIjhN1f57kymK0z6ztBw11AQnrsbGmgY1QzU5s5M+GlAfnyfFULQ/Ze4 KATr1NLy1SQtyUw6oNBHC7p4jco1cmaLUACRYTo/cY3H8PLnMcUpH5CRwdsC7+lup4Du yrqbULGwecR+Y1RA930oMW4sfa4mDJoZOP4GUgwtSlW7iG+pakxciy/Y7F6ujf3fJopC c3oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=LJ9NJDtZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si2139685otq.298.2020.01.29.16.45.01; Wed, 29 Jan 2020 16:45:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=LJ9NJDtZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727227AbgA3AoE (ORCPT + 99 others); Wed, 29 Jan 2020 19:44:04 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:48668 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgA3AoE (ORCPT ); Wed, 29 Jan 2020 19:44:04 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00U0SbKm039876; Thu, 30 Jan 2020 00:43:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=HxaL1diqaEv286OlhDwXeFz8SznwXgpMh0T9XvkcS/4=; b=LJ9NJDtZ0xIKPfo7TT45ZkKFwtd9FFccN180bLdE9yns4f+qBam/ogmCeWLDlc2ZNCAg I+FH9dVYVyMPmEjJyYU2ddfw6f4duwPwx7jCXuAMw49PxmA2JGAHhY+J6wfFjaA7rC0U DY1g+95BqBT5v8sSEvlm9s55Xe2OpckmxNgf+UDRxw9DGZC/CBpXQu/Jm/LchvMU/aOV jxoV82UQsrwH/kS3aw+K7BHRBy3utlkidz/84ERau0SgG7q+VrCvTzEVbwPHN2HxtklE 6Zm2vdYAvRE7A2FV5xurm72isVkq0rcJ2EYPCZe5og/YSoQpt08U8mwyHjf9aqRw9SXQ Cw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2xreargvmn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2020 00:43:55 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00U0Ta5l022634; Thu, 30 Jan 2020 00:41:54 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2xuc2xu82x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2020 00:41:54 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00U0frUM019805; Thu, 30 Jan 2020 00:41:53 GMT Received: from [192.168.1.206] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 29 Jan 2020 16:41:53 -0800 Subject: Re: [PATCH v10 2/8] hugetlb_cgroup: add interface for charge/uncharge hugetlb reservations To: David Rientjes , Mina Almasry Cc: shakeelb@google.com, shuah@kernel.org, gthelen@google.com, Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, cgroups@vger.kernel.org, aneesh.kumar@linux.vnet.ibm.com References: <20200115012651.228058-1-almasrymina@google.com> <20200115012651.228058-2-almasrymina@google.com> From: Mike Kravetz Message-ID: <43930e45-7505-1fc2-36ac-69a91a00a336@oracle.com> Date: Wed, 29 Jan 2020 16:41:51 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9515 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001300001 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9515 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001300001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/29/20 1:21 PM, David Rientjes wrote: > On Tue, 14 Jan 2020, Mina Almasry wrote: > >> diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h >> index 063962f6dfc6a..eab8a70d5bcb5 100644 >> --- a/include/linux/hugetlb_cgroup.h >> +++ b/include/linux/hugetlb_cgroup.h >> @@ -20,29 +20,37 @@ >> struct hugetlb_cgroup; >> /* >> * Minimum page order trackable by hugetlb cgroup. >> - * At least 3 pages are necessary for all the tracking information. >> + * At least 4 pages are necessary for all the tracking information. >> */ >> #define HUGETLB_CGROUP_MIN_ORDER 2 > > I always struggle with a way to document and protect these types of > usages. In this case, we are using the private filed of tail pages; in > thp code, we enumerate these usages separately in struct page: see "Tail > pages of compound page" comment in the union. Using the private field is > fine to store a pointer to the hugetlb_cgroup, but I'm wondering if we can > document or protect against future patches not understanding this usage. > Otherwise it's implicit beyond this comment. > > Maybe an expanded comment here is the only thing that is needed because > it's unique to struct hugetlb_cgroup that describes what struct page > represents for the second, third, and (now) fourth tail page. I think that expanding the comment may be sufficient. Let's at least document what the private field of the of the tail pages are used for WRT cgroups. Second tail page (hpage[2]) usage cgroup Third tail page (hpage[3]) reservation cgroup BTW, we are just adding usage of the third tail page IIUC. The comment that 4 pages are necessary includes the head page. -- Mike Kravetz