Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9591208ybl; Fri, 17 Jan 2020 15:00:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxExDqtY4klRkXqqBMIBuMqpsdpXfstvhG3yFxYJOWL/fJxTtr3gzc44XlpswU+tpVVNGSR X-Received: by 2002:aca:48cd:: with SMTP id v196mr5467396oia.102.1579302018161; Fri, 17 Jan 2020 15:00:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579302018; cv=none; d=google.com; s=arc-20160816; b=EqaAIqMMnFV8PJrkXaMec2jcN3y5I/tHb0F7JIpDjwykID3whn84BRo45wsO6ntr7B 29j+dnytLFZdJ+vyPu2J40/fjkhqpgXniMuQGJ0Qs+39ROvWVL3QWwlfuiOu5Vm9EeRh rg1mU7IfSCJinqZPnFIE9yR0xzo96oyHZaMEEbih27PFRvNDh+J4edjK/DK6Il3zTDIv rtJtXabMwiZAfPKEgAW+56rxhxg0ik+m19SKqiDi8GCwkNUSuPYss5hp54JLkxJpYdlw e23NrJ9IkaUZkG0PGHKJ5tPoNX4W1Bpr6xuHzTWoQUVAP9VHiQkZFAzvOg5XO6UA03Wp TZQQ== 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=dENVIhtYjj5QMBF4ot0Yq+caEuhMLKWT5Dd/N2rM48Q=; b=0iB5TaIMr7trVQCUKg953fgjFQJgrWR9O4eht3DOq6toYAYRbqDpSPR3/SQyA4RRud pQSlcI9FzB/EnKfFDdjwRFEplb0D/rqpPkoZr2x6El5A2u+C/U4k93Uwl/qGdLOv617s zQ1s93ZuxNAT4iR7JTpz1X5zAjgbpx0+tnhisjEZY+WCTcpm5tl7ORSzs0sq8ARUXbHV H0zkxqWPcBB8UuOocU2stapScjOXBeZOKdzCMMHvcgm9lkF04JPaSWSfDrSgZopjq0BJ 7BcwU3GFlHcWQeezs3C6oJEDmbcDI06C+Upo9POcr2/aBUxKz75XHfBVTgN1g4JRqJVo qcEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=gfQ9AU6+; 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 u84si14542232oib.34.2020.01.17.15.00.05; Fri, 17 Jan 2020 15:00:18 -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=gfQ9AU6+; 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 S1729690AbgAQW6L (ORCPT + 99 others); Fri, 17 Jan 2020 17:58:11 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:39726 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729099AbgAQW6K (ORCPT ); Fri, 17 Jan 2020 17:58:10 -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 00HMhrnr174540; Fri, 17 Jan 2020 22:58:03 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=dENVIhtYjj5QMBF4ot0Yq+caEuhMLKWT5Dd/N2rM48Q=; b=gfQ9AU6+gFr7y+gwnYkF8lpRjg5PLqyA3gj5zD9hId1KspjMU2Vx8gwUJ1p3n6HAEN3N mJrQsow7Q/z1eMRpRsi8yi2K4Rx1DTHIuyOCOZFYuz6xQIeS/CtKH+rWkZt0Ap+ZyipQ 92sVO1yRWntXwMduKdKil5ZR/e9p0XUrEjaeMbOqw65mJjnFZm2/2OL+89ozjumAI0g6 D2AauVFhe5N44zxIJhOcMBBnF4csmL4QQHVgbD7NRnpUjL+5gVAV/NGYsjJyS2jua0il bKVUKko9VCpxkUBGLORM/tQ3p6W1L47IOY/Yw4ql/4cPy1y9A7CetvIWKNyuDEvUur87 2A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2xf7403bxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Jan 2020 22:58:03 +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 00HMi0P9072595; Fri, 17 Jan 2020 22:58:03 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2xjxm9r6tm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Jan 2020 22:58:02 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00HMw1rL030830; Fri, 17 Jan 2020 22:58:01 GMT Received: from [192.168.1.206] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 17 Jan 2020 14:58:01 -0800 Subject: Re: [PATCH v10 3/8] hugetlb_cgroup: add reservation accounting for private mappings To: Mina Almasry , rientjes@google.com, shakeelb@google.com Cc: shuah@kernel.org, gthelen@google.com, akpm@linux-foundation.org, 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-3-almasrymina@google.com> From: Mike Kravetz Message-ID: <49e5872e-eecb-4279-bc79-bbc1e132ab5d@oracle.com> Date: Fri, 17 Jan 2020 14:57:59 -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: <20200115012651.228058-3-almasrymina@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9503 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 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-2001170175 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9503 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 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-2001170175 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/14/20 5:26 PM, Mina Almasry wrote: > Normally the pointer to the cgroup to uncharge hangs off the struct > page, and gets queried when it's time to free the page. With > hugetlb_cgroup reservations, this is not possible. Because it's possible > for a page to be reserved by one task and actually faulted in by another > task. > > The best place to put the hugetlb_cgroup pointer to uncharge for > reservations is in the resv_map. But, because the resv_map has different > semantics for private and shared mappings, the code patch to > charge/uncharge shared and private mappings is different. This patch > implements charging and uncharging for private mappings. > > For private mappings, the counter to uncharge is in > resv_map->reservation_counter. On initializing the resv_map this is set > to NULL. On reservation of a region in private mapping, the tasks > hugetlb_cgroup is charged and the hugetlb_cgroup is placed is > resv_map->reservation_counter. > > On hugetlb_vm_op_close, we uncharge resv_map->reservation_counter. > > Signed-off-by: Mina Almasry Reviewed-by: Mike Kravetz -- Mike Kravetz