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 6B148C77B72 for ; Mon, 17 Apr 2023 08:33:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D27638E0002; Mon, 17 Apr 2023 04:33:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD8268E0001; Mon, 17 Apr 2023 04:33:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9F1A8E0002; Mon, 17 Apr 2023 04:33:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A52C98E0001 for ; Mon, 17 Apr 2023 04:33:17 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5B1201A04F6 for ; Mon, 17 Apr 2023 08:33:17 +0000 (UTC) X-FDA: 80690218434.14.F803B55 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf19.hostedemail.com (Postfix) with ESMTP id 534B81A000C for ; Mon, 17 Apr 2023 08:33:15 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=Fuof4IHz; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681720395; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=y0fjpZ5XRmYR+zO82mvm5zAGJNMXJSJ1dcym+RMFYZw=; b=NJLLOYK+XkrmdLvtP7VMzzLcvjGJlAyM56ZT8WSqcrCLBbUWaKxexIoVB7MqfAKWFT3Nl+ Nohy/MUQgGGRZzmEFpKNNJswCLyuVKmhJW5IOGhVCZPrsT3upiDwxcYSlLDCp96o6RJZBa Lf/EV+udjAg66eG5mu4xomgTQPFnWGE= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=Fuof4IHz; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681720395; a=rsa-sha256; cv=none; b=S+GJzKAfpS3FnFeGr52k8JWX/7BBb2+4y0W3XTWkf1YPuhuqPHebALdbgbUSyJ3Yt1v/Uj Bxbdg/y4oS/NR89DwrQ5ys/1MuHKjgktVpDEy/DWYv6dOHHCVXzV4Oef2CFeZoNsQ/J9HS u1c4X2+scf2UmYZNMQU7s46dP7KS7y4= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F24931F381; Mon, 17 Apr 2023 08:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1681720394; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=y0fjpZ5XRmYR+zO82mvm5zAGJNMXJSJ1dcym+RMFYZw=; b=Fuof4IHzw3TWY7DR5DnUhjOmZiJawMeieuXo2zpxFhp3cL5PeTphrwEV1spL3lZEO/DbSi NgqL8daXoijmRRb2K0uRQIwie1TiNhErW3jNBnKboT6gopoand0pOe18M3pKtscxIyRxu+ yvXG6oq9vsci/8g895gXwX+VXmp1tUc= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D274B1390E; Mon, 17 Apr 2023 08:33:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id /xz5MEkEPWRZRQAAMHmgww (envelope-from ); Mon, 17 Apr 2023 08:33:13 +0000 Date: Mon, 17 Apr 2023 10:33:13 +0200 From: Michal Hocko To: David Rientjes Cc: Pasha Tatashin , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, mike.kravetz@oracle.com, muchun.song@linux.dev, souravpanda@google.com Subject: Re: [PATCH v2] mm: hugetlb_vmemmap: provide stronger vmemmap allocation guarantees Message-ID: References: <20230412195939.1242462-1-pasha.tatashin@soleen.com> <20230412131302.cf42a7f4b710db8c18b7b676@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 534B81A000C X-Stat-Signature: 5fh9zrcrn1paupu75c4eg69ty4kyha4z X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1681720395-796125 X-HE-Meta: U2FsdGVkX1+seD0UDCLJB7IcfVVHJO+kpKdMOprdVWOzI5ssmm6e9UZZBfeLPJ+0QRbFB07HV6Thgp4viun76Ycoey0NwEqE/8059v5ghsLQk+CpJHWzfnHuDGkLZQcG3/V4iYppBfiRnBJ8aliU26HoxYfumdbT97D18YXfxHyIK3cyzzfyZy70Qvbkd7JuGT1TcwX6wpiI8L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icity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri 14-04-23 17:47:28, David Rientjes wrote: > On Thu, 13 Apr 2023, Michal Hocko wrote: > > > [...] > > > > > 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. > > > > > > > > This is really an important "detail" changelog should mention. While I > > > > am not really against that change I would much rather see that as a > > > > result of a real world fix rather than a theoretical concern. Mostly > > > > because a real life scenario would allow us to test the > > > > __GFP_RETRY_MAYFAIL effectivness. As that request might fail as well we > > > > just end up with a theoretical fix for a theoretical problem. Something > > > > that is easy to introduce but much harder to get rid of should we ever > > > > need to change __GFP_RETRY_MAYFAIL implementation for example. > > > > > > I will add this to changelog in v3. If __GFP_RETRY_MAYFAIL is > > > ineffective we will receive feedback once someone hits this problem. > > > > I do not remember anybody hitting this with the current __GFP_NORETRY. > > So arguably there is nothing to be fixed ATM. > > > > I think we should still at least clear __GFP_NORETRY in this allocation: > to be able to free 1GB hugepages back to the system we'd like the page > allocator to at least exercise its normal order-0 allocation logic rather > than exempting it from retrying reclaim by opting into __GFP_NORETRY. > > I'd agree with the analysis in > https://lore.kernel.org/linux-mm/YCafit5ruRJ+SL8I@dhcp22.suse.cz/ that > either a cleared __GFP_NORETRY or a __GFP_RETRY_MAYFAIL makes logical > sense. > > We really *do* want to free these hugepages back to the system and the > amount of memory freeing will always be more than the allocation for > struct page. The net result is more free memory. > > If the allocation fails, we can't free 1GB back to the system on a > saturated node if our first reclaim attempt didn't allow these struct > pages to be allocated. Stranding 1GB in the hugetlb pool that no > userspace on the system can make use of at the time isn't very useful. I do not think there is any dispute in the theoretical concern. The question is whether this is something that really needs a fix in practice. Have we ever seen workloads which rely on GB pages to fail freeing them? -- Michal Hocko SUSE Labs