Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp702638pxb; Thu, 2 Sep 2021 13:02:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTKKf43nkZn2l9E1R3hRcCapUUkqZRN3tCtXIIeFh5eyKVKKXBqk6LIwJmJA/8usIVq1vR X-Received: by 2002:a05:6402:1d05:: with SMTP id dg5mr42574edb.375.1630612969112; Thu, 02 Sep 2021 13:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630612969; cv=none; d=google.com; s=arc-20160816; b=XLdZLfEGbxT2ZidV0g21lOVux15GHyRXKDo6PqveIcwZAr1WRnbBqbgrLKQFXuA+6F JoKf3XVpZuCOTA4/vUzNAEJoydDqQwgyq+6ev/ADc6lDbekhSvYCWLiSIOCxtinxp/Kl HlxeFrS83JlDlTdxxJDmjBzUUW+V3GXtO3X8JEclDYVZoETIsg9SHF4eECJV7WXzBU63 5KuT1udjhCokQjM0MI3EUhR40ZZkBbBZ7VTPlrjG8/FK0XowtWcv0wqmK+JZa7MX0/tG 5qIr5Z9xJ5cUrbXzXIVd8bNWRsZ+lsGzsYiLuAi2TfHIfKDms+IS24tb43h4/XG1IdFt TpmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=FBJbFYS9GOV6EVOWjJDcmNKkVbrLdPLLQpcRZp1U3Lo=; b=S24bpYOA96y4/cgK/kLyP/HsIq8wZSmKl3fJqoS1ctZ0+Qt4d1WzroylPgirr9Xf5E /k1wYBw5cQ1co0G861U1XUKEuGXTHEQQCRA3r6t6lsIg5KZulbPONTlPlEnJuFAJO1H2 fZW43hdcVrU/ZknGUqpDCEJlB4yT1UVBRJY5bskdZdmq5v6yJrZfDPwrkkikPIaE7ZHJ Zsa88ZpOPAxpXX8VDBwENrMqSlcKAmp3Yl5hcYZjwM0Y3+IETaySAzxxNzmBrrjG3r4z Qk1Jx/COWAJpoVm5O+7lgAGWV+L7FBx70hjmllo/0EGPKsgPWpUiwKSCDrBOvjDW28l3 x11A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=F13lE2uq; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si2892295edq.14.2021.09.02.13.02.22; Thu, 02 Sep 2021 13:02:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=F13lE2uq; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345290AbhIBN56 (ORCPT + 99 others); Thu, 2 Sep 2021 09:57:58 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:49270 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345262AbhIBN5y (ORCPT ); Thu, 2 Sep 2021 09:57:54 -0400 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 B39C420367; Thu, 2 Sep 2021 13:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1630591015; 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=FBJbFYS9GOV6EVOWjJDcmNKkVbrLdPLLQpcRZp1U3Lo=; b=F13lE2uqBNL7cIzpI01TniOVlc4xNW5ZO2BZI2dJ6afYyrB454Zmhn+mH9+SatFH9xVzpQ ZfKGEBTckXRsgH8XBybfpxxHNQcA0mnznOCjT3CPuats9GRwVCYadzJyd8u+Vlmli+7bU2 X8hLoWJ+sLTVb8upO6g24YHeDKIxivA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1630591015; 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=FBJbFYS9GOV6EVOWjJDcmNKkVbrLdPLLQpcRZp1U3Lo=; b=i9b7kb31nHLHFzgkDvG366ucXQh4DnidX/PceibcSoTwZ1jwf/pQ9lpN0AwFldF98FLLzx 5nxmRNdWDsvlmKCQ== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 7BE4C13732; Thu, 2 Sep 2021 13:56:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id S3cxHSfYMGH7HwAAGKfGzw (envelope-from ); Thu, 02 Sep 2021 13:56:55 +0000 Message-ID: <38d2a358-4146-bfc9-2a4f-68ce02f75c94@suse.cz> Date: Thu, 2 Sep 2021 15:56:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.0.3 Content-Language: en-US To: Mike Rapoport , "Edgecombe, Rick P" Cc: "linux-kernel@vger.kernel.org" , "peterz@infradead.org" , "keescook@chromium.org" , "Weiny, Ira" , "linux-hardening@vger.kernel.org" , "linux-mm@kvack.org" , "x86@kernel.org" , "akpm@linux-foundation.org" , "Williams, Dan J" , "Lutomirski, Andy" , "kernel-hardening@lists.openwall.com" , "Hansen, Dave" , "shakeelb@google.com" References: <20210830235927.6443-1-rick.p.edgecombe@intel.com> <20210830235927.6443-12-rick.p.edgecombe@intel.com> From: Vlastimil Babka Subject: Re: [RFC PATCH v2 11/19] mm/sparsemem: Use alloc_table() for table allocations In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/1/21 09:22, Mike Rapoport wrote: > On Tue, Aug 31, 2021 at 06:25:23PM +0000, Edgecombe, Rick P wrote: >> On Tue, 2021-08-31 at 11:55 +0300, Mike Rapoport wrote: >> > On Mon, Aug 30, 2021 at 04:59:19PM -0700, Rick Edgecombe wrote: >> >> > > -static void * __meminit vmemmap_alloc_block_zero(unsigned long >> > > size, int node) >> > > +static void * __meminit vmemmap_alloc_table(int node) >> > > { >> > > - void *p = vmemmap_alloc_block(size, node); >> > > + void *p; >> > > + if (slab_is_available()) { >> > > + struct page *page = alloc_table_node(GFP_KERNEL | >> > > __GFP_ZERO, node); >> > >> > This change removes __GFP_RETRY_MAYFAIL|__GFP_NOWARN from the >> > original gfp >> > vmemmap_alloc_block() used. >> Oh, yea good point. Hmm, I guess grouped pages could be aware of that >> flag too. Would be a small addition, but it starts to grow >> unfortunately. >> >> > Not sure __GFP_RETRY_MAYFAIL is really needed in >> > vmemmap_alloc_block_zero() >> > at the first place, though. >> Looks like due to a real issue: >> 055e4fd96e95b0eee0d92fd54a26be7f0d3bcad0 That commit added __GFP_REPEAT, but __GFP_RETRY_MAYFAIL these days became subtly different. > I believe the issue was with memory map blocks rather than with page > tables, but since sparse-vmemmap uses the same vmemmap_alloc_block() for > both, the GFP flag got stick with both. > > I'm not really familiar with reclaim internals to say if > __GFP_RETRY_MAYFAIL would help much for order-0 allocation. For costly allocation, __GFP_RETRY_MAYFAIL will try harder, thus the RETRY part is accented. For order-0 the only difference is that it will skip OOM, thus the MAYFAIL part. It usually means there's a fallback. I guess in this case there's no fallback, so allocating without __GFP_RETRY_MAYFAIL would be better. > Vlastimil, can you comment on this? > >> I think it should not affect PKS tables for now, so maybe I can make >> separate logic instead. I'll look into it. Thanks. >> > >> > More broadly, maybe it makes sense to split boot time and memory >> > hotplug >> > paths and use pxd_alloc() for the latter. >> > >> > > + >> > > + if (!page) >> > > + return NULL; >> > > + return page_address(page); >> > > + } >> > > >> > > + p = __earlyonly_bootmem_alloc(node, PAGE_SIZE, PAGE_SIZE, >> > > __pa(MAX_DMA_ADDRESS)); >> > >> > Opportunistically rename to __earlyonly_memblock_alloc()? ;-) >> > >> Heh, I can. Just grepping, there are several other instances of >> foo_bootmem() only calling foo_memblock() pattern scattered about. Or >> maybe I'm missing the distinction. > > Heh, I didn't do s/bootmem/memblock/g, so foo_bootmem() are reminders we > had bootmem allocator once. > Maybe it's a good time to remove them :) > >> >