Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4682283pxb; Tue, 31 Aug 2021 10:42:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpNgxBdFhkemTlno2qUIQpe3sWTBE3He2+qEZ52nGfp/qw33mUOvbUhzc9uoEeha30AYih X-Received: by 2002:a17:906:7095:: with SMTP id b21mr32339524ejk.131.1630431771639; Tue, 31 Aug 2021 10:42:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630431771; cv=none; d=google.com; s=arc-20160816; b=jdP2/n4wS+LAXs4cfPto7p8koTHd9dULY8+NuBWrynx9jLhtQQfrw9S+HIA/ujD5F+ O8bSKKmX34xwQzP9U48COxKlr3+IrLcqLHoUTLpzHGW9rsbtBf8fo+cMlU17//nbQE60 XYC+PJxIw6XNW2sNlxPHoMBRWuOBKOm6Uk7jiB/mFhVB1HI3KtiguTD/xmD9HiRr4YC5 6t5AuSNdyCEmgRUnAxF0/N0N4FptUnEP2+9SH45LVm66EDR1alC7kVuyMIjx3jUn068M V4a7UOc8LkXF0ZKQipzPFgaheWZTXZAa+619t0Ted0Cg2XGV8HoHlcAPpzhH4or0BwXS tYdw== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=SdMI+6lRD2G3u+2aUh0DhRa8Y0EyNFFP/fCE9/AfF38=; b=orAMpBTTApJMk5052oOnBV/skku55uWyCPH5Dr1f1cCMtX+QlWEzjOPreiGZLXCJVi PSxza/34pTXX9kwCiWgCqSHCaA9/B71VK4VVXgYGLHhXquc5vZTej/vxMm29bgOKd8G1 Y0bjQ7BpT5GtHAqZwgsCQEF3jbEmhrfYCAAQYNmH4vvtj9u/zOaAzbFU7g/AL8qrK+pf Jys96MQVqWz7kFIA1w1KmDJXuQLVfO9vHlIhfQrhBM8SizZHs4VfdZ7FQU/GLTn7XMm7 0GTcrEH0itKKOXIvkjukw9A4DBjeidwaqxU4uauSfo2h1sy3tldCH/RY8bJczDZx2//T yLpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kqkkGcIy; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=PlgcLUyq; 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 f11si18182084edr.52.2021.08.31.10.42.27; Tue, 31 Aug 2021 10:42:51 -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=kqkkGcIy; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=PlgcLUyq; 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 S239914AbhHaRle (ORCPT + 99 others); Tue, 31 Aug 2021 13:41:34 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:49322 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbhHaRld (ORCPT ); Tue, 31 Aug 2021 13:41:33 -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-out1.suse.de (Postfix) with ESMTPS id 30AB522151; Tue, 31 Aug 2021 17:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1630431637; 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=SdMI+6lRD2G3u+2aUh0DhRa8Y0EyNFFP/fCE9/AfF38=; b=kqkkGcIyh6CEA3ka71xoIpNa4R3Y+ziCRvBQEaDLiYOQKo7orFmj+LUueWOSLXNHxgtDzG dfMd3Pm9o+kwRkRYM2+FhqarrUfZgNWVBmXIR6KscUIvxyRY0FhX6KaYkYqwscFydQztee m4H0f3QfR/JQ1XaWyBBAEuqhupl/0FM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1630431637; 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=SdMI+6lRD2G3u+2aUh0DhRa8Y0EyNFFP/fCE9/AfF38=; b=PlgcLUyqlpnPq0vYXl74bfk9ATownostgZC1o+12r/KnkdYqQdgJfkkT6fPmsCD1rgCb1K UamHX93Js1w7pCBQ== 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 0761713966; Tue, 31 Aug 2021 17:40:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id m+BoAJVpLmHzZwAAGKfGzw (envelope-from ); Tue, 31 Aug 2021 17:40:36 +0000 Message-ID: Date: Tue, 31 Aug 2021 19:40:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.0.3 Subject: Re: [GIT PULL] Memory folios for v5.15 Content-Language: en-US To: Matthew Wilcox , Johannes Weiner Cc: "Darrick J. Wong" , Linus Torvalds , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton References: <20210826004555.GF12597@magnolia> From: Vlastimil Babka 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 8/30/21 23:38, Matthew Wilcox wrote: > I think something that might actually help is if we added a pair of new > GFP flags, __GFP_FAST and __GFP_DENSE. Dense allocations are those which > are expected to live for a long time, and so the page allocator should > try to group them with other dense allocations. Slab and page tables > should use DENSE, along with things like superblocks, or fs bitmaps where > the speed of allocation is almost unimportant, but attempting to keep > them out of the way of other allocations is useful. Fast allocations > are for allocations which should not live for very long. The speed of > allocation dominates, and it's OK if the allocation gets in the way of > defragmentation for a while. Note we used to have GFP_TEMPORARY, but it didn't really work out: https://lwn.net/Articles/732107/ > An example of another allocator that could care about DENSE vs FAST > would be vmalloc. Today, it does: > > if (array_size > PAGE_SIZE) { > area->pages = __vmalloc_node(array_size, 1, nested_gfp, node, > area->caller); > } else { > area->pages = kmalloc_node(array_size, nested_gfp, node); > } > > That's actually pretty bad; if you have, say, a 768kB vmalloc space, > you need a 12kB array. We currently allocate 16kB for the array, when we > could use alloc_pages_exact() to free the 4kB we're never going to use. > If this is GFP_DENSE, we know it's a long-lived allocation and we can > let somebody else use the extra 4kB. If it's not, it's probably not > worth bothering with. >