Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2573963rwl; Thu, 13 Apr 2023 08:10:32 -0700 (PDT) X-Google-Smtp-Source: AKy350YHUAEeSVchbzoTh+wba6hWXp4jbvG+WP0tlNLA9bxIWFtiVFbnlhLXMdHgLjIROYJ8RHMF X-Received: by 2002:a05:6102:3031:b0:42c:59ad:1bc2 with SMTP id v17-20020a056102303100b0042c59ad1bc2mr972813vsa.33.1681398632530; Thu, 13 Apr 2023 08:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681398632; cv=none; d=google.com; s=arc-20160816; b=dufWMLiga2+sMbUdMsUtQ9oOby3gHR9UN94oMVv8h7rYsDUczjUB+Qv1eQnigijdSq RzbHYZHqFdg9y/RaksaOBW/hJcv2nGqSZnKhaqM5fu5jNPsK/73CAsexADDOKikzWv1K 9MwM5GUC93wZM6igyLX28N2rwh0my1dWHWaDYzP0ZIoinbPPK+zCc/uz2tY2mIoX+QCi Sk/m2UQNOI4Yq7Rz7MoHZZ3UA925q654dpnTTw6y21umZLWwUtBoruosCfV0TPPtPahb gDpeVBlOiZRU14+7oV/jHVCpB7aLl4tE322QC4h80jX777vkVhtIOahAHvh7IBmN692y 6cVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dvfniPNSYeUesS1D9MOm6MMuLm1MqhhGVDilAjS1vec=; b=UPu8MRcnp97Ip+v2yaFgs3hTiKPpy0zEdvb60PQxGrMVgugbx/V8lsp97EyJLn6wlp FmXNUmOqVZRclBVYBZ3e7zjE5pSyT1WowG4Rnuw6KfQAExLATLf5VTEBhBuVPUhNP1NG rNfdV9ydK0lxH2pz1B2V7EwglaLC/ogM14lJ0VE1iP9Yq3Wm65Wwig+AGC6ou4eOl1ON tVYraVbXmLGPijVLBF65g0lz3L3lghDn03r992ZpvRKv+BF8SM2cHjnwuRoN5eY56uli fs8fUlx4R3/uDdeCvAR5UkYpkZ+tkOvP2gFfv/KUihck/XvSo+K4hZDOPxEHcwSjv+A3 Bl0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=TjNkwnrE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a0561023f0e00b004261c51aebcsi483255vsv.36.2023.04.13.08.10.17; Thu, 13 Apr 2023 08:10:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=TjNkwnrE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230303AbjDMPAM (ORCPT + 99 others); Thu, 13 Apr 2023 11:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbjDMPAL (ORCPT ); Thu, 13 Apr 2023 11:00:11 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7CF5A27D for ; Thu, 13 Apr 2023 08:00:07 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id z1so5923408qti.5 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=cJ4FnAZ48S4AT0LKDWk3B0aFiJMi+HjtCvu9H+oDG5tWNTaY40SZ5esJy7IO5ipsuD bTbYg35jm6zHdOUqWrsPChWJxcEvVEqc1kRy40EtuXK5V+LD1epJBJp4yk0ggAM2UgLk aLfoCixPiyoYIOFTiT5Tu4SjoO0NJyjYaRr68TXnDuf5WgLWP+pVSn2Hi4xgQafp8a05 3bhauWjW18ms4lrk5bLUg4YUaRUJfdWpJHD54OdQEgemzp7CEHrQJczJ9RX9V5uWHhfv fR7HZxtV4Mqtc8ELCIz6o0+tWPf/ZwJtDmOmFz/0YAw9wuNF2EwuROmhsN3EUDX+bswn 04SA== X-Gm-Message-State: AAQBX9eRU9zzWMIYWa4IKnIbIcS2d/vPi599e3/GjJNmJHKj8xIu5UYu 1C3G3GWyjW2lxcAwPPsbjclG4HxPpwotOA0hMbVNWbw6g3dRXJVxXck= 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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