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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70F9EC77B6E for ; Thu, 13 Apr 2023 15:06:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3FD5900004; Thu, 13 Apr 2023 11:06:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF043900003; Thu, 13 Apr 2023 11:06:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB87A900004; Thu, 13 Apr 2023 11:06:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AC501900003 for ; Thu, 13 Apr 2023 11:06:01 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7AC2F1A027E for ; Thu, 13 Apr 2023 15:06:01 +0000 (UTC) X-FDA: 80676692922.03.7C5025A Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by imf15.hostedemail.com (Postfix) with ESMTP id 68974A0023 for ; Thu, 13 Apr 2023 15:05:58 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=ROi6rVGi; spf=pass (imf15.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681398358; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QfzHe58YhokPe0JZwdIWaRO+RRdS5beb3bGyF0eQI9A=; b=wm0GmpVDfi1yDSaUdc9iJa3GqhjM9Oh12NBkKS3oxDkUuAbQA8UWvBgLOjnAhNIQty66Ld KPvcb1yd4CTOp7QoXHCh+A0XDXAvavtJjXrUXe/jzn+QxPip2as9i6fcUxW3TEYxl45QIU 9Nmo62nFECOoqEpdND02mZbz0Lpns6E= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=ROi6rVGi; spf=pass (imf15.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681398358; a=rsa-sha256; cv=none; b=tElikl8ntyPBQ06JHto+L2Iq222TYiWKjGfCQcgoNdnFnDUuQmY245Y+Mj8uDjOZoJDXlS Hc6zwlbv+JubEFhp/gDWZWrI9VH+TiXpCaaoqO8KV6Lok9xKmvKSkjCF/QLX1Dp2Ydz/mB 5iQmRgI2oRtbK6/nBJ8TGZpjIAf/B48= Received: by mail-qt1-f182.google.com with SMTP id cm23so6433104qtb.3 for ; Thu, 13 Apr 2023 08:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1681398357; x=1683990357; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QfzHe58YhokPe0JZwdIWaRO+RRdS5beb3bGyF0eQI9A=; b=ROi6rVGibUkfVQXcAw/Kwi1xI2WfRMJgPG2NUJeFIY2uOZByDvOWQTlLa/Y6+kKDcY dNNMh3mM+4ApvVjcVlwAERWhnO5BDySYjFYfZLwFVO0HQkXM9BPN4DFV+7BIij4XxZD8 65Pa4x4izsTNV5dmby3WRo5KRsZ4zFkKHBVkle31d6I3vbVj1Y1iKm5mi1sL7U7SEhC1 bFAWLHYKxUK6lClgZthZJZpBGrubbzb55KRMK4vIX5aSbOBnbziq2o/ASWMeGtRc8DaY DRTarurhmkMhBCIAaU5zgxQq8TvuXsteIGRjRfk+Cy+wXM0B6YpPsmpKZX+vtPjy6e/F C67Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681398357; x=1683990357; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QfzHe58YhokPe0JZwdIWaRO+RRdS5beb3bGyF0eQI9A=; b=Yt+bqhxkRERSuQ5ZGYFn2UMo15N2GlvdlynceKetiq/Z1rwFakDV/hg6VPy1MhD1BB /DOFAO92ZJcKd+w4OAF/OTwckXtgDrjyEw+MM9Kwkc8nCm+V8R4W3v0LN2bufu4q/cDN zSGyqDCAqtUNWYuOAoHmTMdGNOnM24UePsOBnFUHRmW3VEKpSdtnCgYyey7tRPHGIYOc mrokq4WtBJUR1NJvEpyIrCfpbApj5Ug2YAzznz7jrTy0t5olMjX4IFAEU9ZmfA3RDkIn c3tHyzUaCVAY0gW6z0NPe8GID+nMDpoBQvnkURQqvjfHv+S3stKFOkV36DT3ttSG0d0f O1gg== X-Gm-Message-State: AAQBX9fQi4VpjMNNfnjWYVj5pOk0j5qXKqqUUJBu2W5u5ywUOXFS5wfq mNelcmcDTmZLcLP5jeB+ezlkD3VNWblI0GBB3w0+mg== X-Google-Smtp-Source: AKy350aPdF4g6Xc9Hanz4/44uPGz+bFRHccMJR3Zup7sfa2XJpWrLNMyIG6PWH/6XB+zuQgvn0zLwc+R4Y9a7Rf3TWU= X-Received: by 2002:a05:622a:1a99:b0:3de:bafb:82b0 with SMTP id s25-20020a05622a1a9900b003debafb82b0mr764770qtc.6.1681398357504; Thu, 13 Apr 2023 08:05:57 -0700 (PDT) MIME-Version: 1.0 References: <20230412195939.1242462-1-pasha.tatashin@soleen.com> <20230412131302.cf42a7f4b710db8c18b7b676@linux-foundation.org> In-Reply-To: From: Pasha Tatashin Date: Thu, 13 Apr 2023 11:05:20 -0400 Message-ID: Subject: Re: [PATCH v2] mm: hugetlb_vmemmap: provide stronger vmemmap allocation guarantees To: Michal Hocko Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, mike.kravetz@oracle.com, muchun.song@linux.dev, rientjes@google.com, souravpanda@google.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 68974A0023 X-Stat-Signature: rcmsgj816n3jenq6c5qd99wrezmpxzrn X-Rspam-User: X-HE-Tag: 1681398358-471885 X-HE-Meta: U2FsdGVkX1+qYIDuhrzAVlAqIyWvnvqLuQiAGTkYIMhNpLnYZvq9hKnd+J7rbdMh5VR+TpHFGG4G5NqcVOM5vRhSzNd5ur6FIgeslcLiWDmqz+vXBJdJyx03aIIgRgMvoJzhqSeZ2w+ShMAS8y5fPykM4q8xY8rQ8wcgyA4opKv/ewF5w6ZFjCSmEFL/SJuWmwUv6fk81wWVjuWhewk0e2tNo1siEdohLmKGGUCVo5W37qtwknlFedz2CuVEsQTe0s63VHmbjvRJJRcspzOqvrbgYbHUHF6zFJj0v6vnvBB1UZg+XTjj/yfMz4MGKPZIj53yOzpKM0TUi0XjlEfVux2UomWlLbd+L6SjM0Cn2rXG5wmSzzhyps0q9eniwFQ93QciGZ+OpgPnrN/EyR6oHLuA3hUCVquZLj4b+H3scOs1rnc74JHH7E6Bgh5QpnAbT7YGmTiwcrcDxi2sdGs3ccbEAZjMozoWGSvL93n+UK5CaEwC80SCl1VDl4a0b9hzkoBln79dmPpcvsnrmemC7Okegga5LvaLfif8TBkJrnAdvzFu1Jo9ft4yyDeaFufVrHUt8nZ8GDfz41KeZtQkHeJyT5+X5Dw5Qe7oX5FdMsvDAsXSpvfm5mGkkpfM1EswbCea3hKS1Q7a12zWGChGATL6BOvg6hEN7MUZi61DBnETIzJd123VeoVItoNdzWCMrFQOHeFc2p6IJmj+U6EwPz4jD0P3IsWVyNYlK3Yb8QjDDFg8Gdvbl2fVOZ6IJBDGatB5LCoH6cP9Cwd48u49Z4KYprNtEVFrERRWptaSVyI5WVmY7yusM+QFckNQRLoTL0DzxxTWF6kBMTKRt/g5m2qG7WsKUQ2sHtEiu5aVu6p9lniYKmbeuRh+s4wWEdqIlJJdOvn9DaxKXb1y5L4yrQneAY9AhhJP7i+nPFHj2W9sdvbUOkBbMWeD92e5YwnPuNH0hspwqGFbM88moGO BQsvuHxC cKwN4Z9KgJBi/Ha2FkqnF+EO7oGXI95Ap5mnm7Yt2WTrg2tdI9wDmzgaCevMscTvrU0Mz3+ROJpWI+br6ZCOOFl0TSrGsdslJK8kuWpdvYYmnFLM2lsK/aPJRZHyPSmzoJrofCxBVyNNAPxBouwiFRzYYRlbQHjx6rheoU3lyC/in+nko4Aib6qsD/XDS+cuSlfRp+Oz3fYg8izlXaZs2e+9KYvFH/P25dLBdGizdfvz9qlbQdMZ4qu9NkefCq4rIJtQ7LDbocF5/qpjxgT/IwSyAR9YOjcGaAAJnPL6uKY9vNtnXYfqDkQKJWef11mrUQ4Ql+8iVELNXXXTSA5pMzB4Hiv9HQ9ZX489Ubc7jjwOjg3EWgqvWZAZbDivka4cDDT4HDi/ivEaJcuNHdAuRSQFMv/PeJrrI7AbQMhRz/FrB6/7cw2iB/J5ki8jNcdeaBj2O 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 Wed, Apr 12, 2023 at 4:18=E2=80=AFPM Michal Hocko wrot= e: > > On Wed 12-04-23 13:13:02, Andrew Morton wrote: > > Lots of questions (ie, missing information!) > > > > On Wed, 12 Apr 2023 19:59:39 +0000 Pasha Tatashin wrote: > > > > > HugeTLB pages have a struct page optimizations where struct pages for= tail > > > pages are freed. However, when HugeTLB pages are destroyed, the memor= y for > > > struct pages (vmemmap) need to be allocated again. > > > > > > Currently, __GFP_NORETRY flag is used to allocate the memory for vmem= map, > > > but given that this flag makes very little effort to actually reclaim > > > memory the returning of huge pages back to the system can be problem. > > > > Are there any reports of this happening in the real world? > > > > > Lets > > > use __GFP_RETRY_MAYFAIL instead. This flag is also performs graceful > > > reclaim without causing ooms, but at least it may perform a few retri= es, > > > and will fail only when there is genuinely little amount of unused me= mory > > > in the system. > > > > If so, does this change help? > > > > If the allocation attempt fails, what are the consequences? > > > > What are the potential downsides to this change? Why did we choose > > __GFP_NORETRY in the first place? > > > > What happens if we try harder (eg, GFP_KERNEL)? > > Mike was generous enough to make me remember > https://lore.kernel.org/linux-mm/YCafit5ruRJ+SL8I@dhcp22.suse.cz/. > GFP_KERNEL wouldn't make much difference becauset this is > __GFP_THISNODE. But I do agree that the changelog should go into more > details about why do we want to try harder now. I can imagine that > shrinking hugetlb pool by a large amount of hugetlb pages might become a > problem but is this really happening or is this a theoretical concern? This is a theoretical concern. Freeing a 1G page requires 16M of free memory. A machine might need to be reconfigured from one task to another, and release a large number of 1G pages back to the system if allocating 16M fails, the release won't work. In an ideal scenario we should guarantee that this never fails: that we always can free HugeTLB pages back to the system. At the very least we could steal the memory for vmemmap from the page that is being released. Pasha