From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90ADDC33CA9 for ; Mon, 13 Jan 2020 22:08:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4F85D2084D for ; Mon, 13 Jan 2020 22:08:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="icmnkw9K" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F85D2084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D92B08E0006; Mon, 13 Jan 2020 17:08:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D42388E0003; Mon, 13 Jan 2020 17:08:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C57FD8E0006; Mon, 13 Jan 2020 17:08:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id B0A848E0003 for ; Mon, 13 Jan 2020 17:08:08 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 65C96180AD80F for ; Mon, 13 Jan 2020 22:08:08 +0000 (UTC) X-FDA: 76373999856.07.move04_29e88890a661e X-HE-Tag: move04_29e88890a661e X-Filterd-Recvd-Size: 5444 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Jan 2020 22:08:07 +0000 (UTC) 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 00DM4GG2156350; Mon, 13 Jan 2020 22:08:04 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=bteqaIm33REwMocLQp5eXrWHmlZN7JbTCADnuM17JQ4=; b=icmnkw9K8LowJlmjZNZAJ6hy/yKzAOGnl8G9HV9FpnWaw2/+Bm5o5JI56Xh4scExmOoa NNlxoshBc8UPFAhtmxbKgCjuVUbmH8zCmeRKMJhZGc/4fA0ya7gzeGCUh/KrZ2Bj7Oqe 2gjgUJKpPtK4j9nxCOYE5XqjAVAAvjJJayqkONUpL0g6AY37Fx5l76/0/oGD1QQjrMmo 6vHutDBl9TXXQ6aW1c01hSYasayexIyrDVdUJ21bitn5OUUlcDv2VGGgnMQpqpExbi6W iBMFGPiuXGPxe2R78DLEw0UTI+QL7zeVbvvTs6jHSJEjM/8eFi4+ke2ZixsQ5S7D5v8A Pg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2xf73y9vy4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jan 2020 22:08:04 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00DM58nh180288; Mon, 13 Jan 2020 22:06:03 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 2xfqu596n9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jan 2020 22:06:03 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00DM600g032689; Mon, 13 Jan 2020 22:06:00 GMT Received: from [192.168.1.206] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 13 Jan 2020 14:06:00 -0800 Subject: Re: [PATCH v9 1/8] hugetlb_cgroup: Add hugetlb_cgroup reservation counter To: Mina Almasry Cc: shuah , David Rientjes , Shakeel Butt , Greg Thelen , Andrew Morton , open list , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, cgroups@vger.kernel.org, Aneesh Kumar , =?UTF-8?Q?Michal_Koutn=c3=bd?= , Hillf Danton References: <20191217231615.164161-1-almasrymina@google.com> <817e2c4b-4c72-09f9-22ea-bbaf97584161@oracle.com> From: Mike Kravetz Message-ID: Date: Mon, 13 Jan 2020 14:05:58 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.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=9499 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-2001130179 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9499 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-2001130179 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 1/13/20 1:03 PM, Mina Almasry wrote: > On Mon, Jan 13, 2020 at 10:44 AM Mike Kravetz wrote: >> >> On 12/17/19 3:16 PM, Mina Almasry wrote: >>> - While usage_in_bytes tracks all *faulted* hugetlb memory, >>> reservation_usage_in_bytes tracks all *reserved* hugetlb memory and >>> hugetlb memory faulted in without a prior reservation. >> >> To me, this implies that 'faults without reservations' could cause >> reservation usage to exceed reservation limit? Or, does the faulting >> process get a SIGBUS because of the reservation limit even though it >> is not using reservations? >> >> We shall see in subsequent patches. >> > > The design we went with based on previous discussions is as follows: > hugetlb pages faulted without a prior reservation get accounted at > fault time, rather than reservation time, and if the fault causes the > counter to cross the limit, the charge fails, hence the fault fails, > hence the process gets sigbus'd. Ok, sorry I did not recall the design discussion. > This means that one counter I'm adding here can cover both use cases: > if the userspace uses MAP_NORESERVE, then their memory is accounted at > fault time and they may get sigbus'd. Let's make sure this is clearly documented. Someone could be surprised if their application not using reserves gets a SIGBUS because there is a reserve limit. -- Mike Kravetz