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 A721EC77B6E for ; Thu, 13 Apr 2023 18:12:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BD026B0074; Thu, 13 Apr 2023 14:12:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 26DC1900003; Thu, 13 Apr 2023 14:12:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 134FB900002; Thu, 13 Apr 2023 14:12:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 057D66B0074 for ; Thu, 13 Apr 2023 14:12:23 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B5D44AB4EA for ; Thu, 13 Apr 2023 18:12:22 +0000 (UTC) X-FDA: 80677162524.21.663F321 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf23.hostedemail.com (Postfix) with ESMTP id 7C48A14001D for ; Thu, 13 Apr 2023 18:12:19 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="dUP4R9a/"; spf=pass (imf23.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=1681409539; a=rsa-sha256; cv=none; b=FlWDes7MZ4ZIs5qQ6l7vkpXTfyuEmq/JpDJCR9MO/FZAKVz2Bx5EmFgB/nqJnzvM5WWXoR 1f32NsfwXcih6tSyROpHqcjeueDm3QkLAiu3eYu27XoH1s8DlxyvhUOSvKQ57WyWf0h/Bj jHjL89su1YN0zbACIXlAeJLg7Uq9Mbo= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="dUP4R9a/"; spf=pass (imf23.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=1681409539; 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=dvIUkicyd0SkqaB5uD6BHKFL2IXzKJbP500i8yNOqIo=; b=owy795REcNi/pJFiOGvFp3i3AUVaYTECF8oC0b8KvGYAP3AabLcdq0KVdWAs6Lt9NZXPgn YRbFg0UTjt5J72OIYMKQEqudGSMP3LqsrB1hK4mAhD5CTF0gGIUF0Ne6Zi1thOA+dgCL1/ JqrZRAQkr/6HV94+zpZEAawC503AsZs= 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 DD6291F45B; Thu, 13 Apr 2023 18:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1681409537; h=from:from:reply-to: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; bh=dvIUkicyd0SkqaB5uD6BHKFL2IXzKJbP500i8yNOqIo=; b=dUP4R9a/iS19V1cWqjLT2hvSSgdv457l3zqZYdcCb6eClfJbCbjkWpp3Ja4pkMRKOToTo3 Yl+7+KMHwMc5mVkBJapeyR4CU7367nUelGOb1fW2173KkR06CqNL8Qt20Sy3j+B5MRz2fX txrfeXbE1KhZZrGOtaZ8HNLgyH7mGtQ= 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 BC87F13421; Thu, 13 Apr 2023 18:12:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6IywKwFGOGQrKQAAMHmgww (envelope-from ); Thu, 13 Apr 2023 18:12:17 +0000 Date: Thu, 13 Apr 2023 20:12:16 +0200 From: Michal Hocko To: Pasha Tatashin 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 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Rspamd-Queue-Id: 7C48A14001D X-Rspamd-Server: rspam01 X-Stat-Signature: npnyatcbikdy7hdc1twemxwt6nqbccex X-HE-Tag: 1681409539-657370 X-HE-Meta: U2FsdGVkX19fvSuGptbKgoRg9522oMXkz0PzMQg2ROssJjA8OAA/Jgc2RmNLJ2ppJRtR48Bw7mr2Z48XXfVNTNPepQ3RsmOtch5RB84aqmSnxk7Wt0EDCaMLgVvl2YtkBUQy2plOKbyknBLxex68XbKosBIFr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JIK2VPe2ss9YXbQjqqCTXzlFipE= 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 Thu 13-04-23 13:11:39, Pavel Tatashin wrote: > On Thu, Apr 13, 2023 at 11:25 AM Michal Hocko wrote: > > > > On Thu 13-04-23 11:05:20, Pavel Tatashin 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. > Otherwise, we will never hear about it. I think overall it is safer to > keep this code with __GFP_RETRY_MAYFAIL flag. > > > > > > 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. > > > > Yes, this really bothered me when the concept was introduced initially. > > I am always concerned when you need to allocate in order to free memory. > > Practically speaking we haven't heard about bug reports so maybe this is > > not such a big deal as I thought. > > I suspect this is because at the moment it is not that frequent when a > machine is reconfigured from having a lot of HugeTLB based workload to > non-HugeTLB workload. Yes, hugetlb workloads tend to be pretty static from my experience. -- Michal Hocko SUSE Labs