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 42ADCC77B6E for ; Thu, 13 Apr 2023 15:00:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C450900002; Thu, 13 Apr 2023 11:00:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74D566B0074; Thu, 13 Apr 2023 11:00:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5ED9E900002; Thu, 13 Apr 2023 11:00:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4C8886B0072 for ; Thu, 13 Apr 2023 11:00:11 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0B92812028E for ; Thu, 13 Apr 2023 15:00:11 +0000 (UTC) X-FDA: 80676678222.13.864AFFF Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by imf01.hostedemail.com (Postfix) with ESMTP id 9660C40029 for ; Thu, 13 Apr 2023 15:00:07 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=TjNkwnrE; spf=pass (imf01.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.176 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=1681398007; 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=dvfniPNSYeUesS1D9MOm6MMuLm1MqhhGVDilAjS1vec=; b=YJ0xmWcP9BemrZAPeVyBfq38bARD//bdHqxjZm3A681ZWYU7cAvC7rTvwedLP4TiWbvuUh 9MBZZyQUqL2ziFSLHQOW3TLmHoxG58lkiJsRXIlVXwidsLGlZe95c72ifPGitLAyAQLG10 Z3OL8BKPhOaRMdBVsBPko7RHi4enK3g= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=TjNkwnrE; spf=pass (imf01.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681398007; a=rsa-sha256; cv=none; b=eN9zNZJ2FR7AiXjzZBVTw3T7NcvIVzGVpjOkIfrwHTiRAmvdbOinrLhCqS0yuYjArh+Poy 43u0uY+8xTb4jAAwmbJG8TLbTSznILOA3Hhtn6gXzB28lmu4FeOHKZITfuoJVJuxqj8fma t7iDY6nUrTy4sGK5PBxaWMdjO7IZeh4= Received: by mail-qt1-f176.google.com with SMTP id bl15so13472272qtb.10 for ; Thu, 13 Apr 2023 08:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1681398006; x=1683990006; 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=dvfniPNSYeUesS1D9MOm6MMuLm1MqhhGVDilAjS1vec=; b=TjNkwnrEuHeLO4D4dAwwTEmHxXJkFC0by55qNpsV/oAIKf7rlJnhDa5IrpF4xcieTf yiGTsuYYbSshvI6dhUBEoBoWrWmX/YRhLBHsA0FiN31ekZ4kigJwpBCbDU1Q41jCe8AH en8oWQxY9e8NgSnyV0jfHh31fH8mEK53VeBtyzG6OJaKf2a5KgQo+dzJAAR3L0jK+3iO /q9uEd1m5sNz9645OA9Rc//hoPYfS8YDV3FsNV5nWexeug9xf6NC2oSW/XPfPws1H1E1 gokmVGgUEAh9XY1X9wy2wBsj1Ff8KtJdY5TYMVnF0TnPFgfIRis++++OCpqBgJRCNbO0 0G5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681398006; x=1683990006; 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=dvfniPNSYeUesS1D9MOm6MMuLm1MqhhGVDilAjS1vec=; b=jFUV02cmveMhIcEz8/4w7lPVbNuHxaRFmX6jElh2JU/Ln8RMuKJotMX/w0u3DJy1g6 jy6v5PnkaLbZi2wFVMedCE3mjLVMxmui1YLK7CK2GQqgqc5IlDYVpxJT5/1Qg3/zV/rQ PYNVQ66chbm8B5eJaHMsW3UCkEFocHzn0pugjnsat4ktkwYkdaDD53FNywMPU3DB+unY MkC+wxsPgyqA81qn264BPJEcufaApGdp6QKhSFa1NV2A+WyfiVqqcy30pDbNJTulcPqi f53SEAOta47gteWQTF0DXei+QKiKeqg0Ffobc9Oa4o0mloW4OgHuu1xE0ABhZ0YZallG ZT4Q== X-Gm-Message-State: AAQBX9fnG7Fg9G+n8Br2lskFGzQRpdO5/xZU0rKxVsTkbcS8/1YO3HgS 3/BpDmbXHzrNLl28ZqBCVDNtYv2pn4nyfx/p/+5qJA== X-Google-Smtp-Source: AKy350Z+XXHie6JNtWSAJzbOSOZ0nv5M81HQwB6e4FcGZgFrbRezqaZzU/ePj56MENMRYkEO9BAbN4/uRAct2SHD7hc= X-Received: by 2002:ac8:7f81:0:b0:3db:cd1b:e227 with SMTP id z1-20020ac87f81000000b003dbcd1be227mr665460qtj.6.1681398006396; Thu, 13 Apr 2023 08:00:06 -0700 (PDT) MIME-Version: 1.0 References: <20230412195939.1242462-1-pasha.tatashin@soleen.com> <20230412131302.cf42a7f4b710db8c18b7b676@linux-foundation.org> In-Reply-To: <20230412131302.cf42a7f4b710db8c18b7b676@linux-foundation.org> From: Pasha Tatashin Date: Thu, 13 Apr 2023 10:59:29 -0400 Message-ID: Subject: Re: [PATCH v2] mm: hugetlb_vmemmap: provide stronger vmemmap allocation guarantees To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, mike.kravetz@oracle.com, mhocko@suse.com, muchun.song@linux.dev, rientjes@google.com, souravpanda@google.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: h3hhqrm79dhrgz55mypj83nhqcx4iqt4 X-Rspam-User: X-Rspamd-Queue-Id: 9660C40029 X-Rspamd-Server: rspam06 X-HE-Tag: 1681398007-420201 X-HE-Meta: U2FsdGVkX19l7OJnv5iOpcfAc7wARxVJsXrEt8bMxdtKWPuXHAorqhmitVLA/X5aj06OzRVmRMcVbgkzja81iovLW1cLyoEEctqmweDja1yKZ7feBNROpRfFXp1hPfnktLwtZQQPGfSlwKdGMycxLSDsNLW2/+CbTzeiVTkAvs71jQQQAg4KYM37O2yTGZcUVfHs/e6LKhk/fcAe5WUhDCz51vEmswbsNtO3z48C3N7YS46PTzjERD7gGUF5TdtrxFs+y7Mc4tGIS2eFctNG0+CD47ueLV/01gugNl5Q0ZH0KaugS5GxGYjqq+z8H9bHAowxV1s93uqMj1aisAzFUsdF/H2ubD+20fQMgVVJbLXQN+LcnfRGJmO8qKlAPMV7pYfNERfa/4uKZ+pKeHCyIW3M0yPBTIWSP59nH4e+WAwDag4elgTyCI3Rbs7VmULgDWJkfbBsLxBJZXE1KPEF8CGv6e4Vkgyk4VRB7ztCZMbLPFOxWkna67GgCzhiXW9+8/tAdj42Qy75fyBK0mqs7J+LlrGDOkEWXWlyoqvdIpnytWQUM6QrKmwCqk4urbN4PlgK+V7n9MCQNKyxz87y6O6bFkl1/pbKCedldypOqDYNhT3uOMyNeu2fDnIWCRZMFULOTnRb714JhXLODo1iR6MO/cqiucmvaF21klrkPchjZ6MD7hAOFwEyvTau0kxy7RygiRQIT/OqBqXfIuYrsA+wgMSQlJAJCG7Z3UO10Ib3OKwKEbZPc7eDmcmG0djpuV05VbG7NhXgcGSuYB9epWG9Yj2opsI67CN36aHkavw1PMzA11Yu6JKzZFwXySft+am6VqOMs2habDAE9tBKuaqc4dSKyHnlfNZlan7qMwWrjP8iefEIaFIWiNdmFw2CAn8885GhawHii/s/YtiOTxuS/u3fN2e/k7ZBVTNdiUHberx83TcB4XmAS8cMWpnHh58e0OYGKV/ZiS+viFA 6piWeFBd YvjsG+L2ysQtfzXkZysehYhITH/pc2XtjtwU0viZsUWGdcyzeSnxqq2Qx8uoIK6mEj1g6RLjVL/C6KWsOqfVOm9EU52ui0lNnROH6ln0zoAxvodWUKTRMXcFDNDrHDVKV4uIbq4ukc4OjC6QylcUNJDLRLQNkENqFkm5zM57D3YzczFbccYyh/FSfO54M5AUhsc+JvbnCOk3j+rs5uM84hF1K96Mh5jlS1YFgPEb+2SV8aFQA7kOTwC08Ksnt2vymxJ0nOdSlSojGTilOcoJKXXYkI3pGbmy5fXOSXhZJt7LlK+friaC3HG52DmzI6hwVusvQixOjlOmpEOKOKKlAoG4lp3u8H1Y90a2lm7WCkgtMHUU/xMKpJ0cMHRYoo6wGgG2U X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, 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:13=E2=80=AFPM 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 t= ail > > pages are freed. However, when HugeTLB pages are destroyed, the memory = for > > struct pages (vmemmap) need to be allocated again. > > > > Currently, __GFP_NORETRY flag is used to allocate the memory for vmemma= p, > > 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 retries= , > > and will fail only when there is genuinely little amount of unused memo= ry > > in the system. > > If so, does this change help? It helps to avoid transient allocation problems. In general it is not a good idea to fail because we are trying to free gigantic pages back to the system. > > If the allocation attempt fails, what are the consequences? The gigantic page is not going to be returned to the system. The use will have to free some memory before returning them back to the system. > > 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)? MIchal answered this question, that it won't do much difference due to __GFP_THISNODE