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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7212CC433B4 for ; Mon, 5 Apr 2021 21:33:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 61543613BD for ; Mon, 5 Apr 2021 21:33:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61543613BD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B9A476B006E; Mon, 5 Apr 2021 17:33:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4B3F6B0073; Mon, 5 Apr 2021 17:33:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A12276B0075; Mon, 5 Apr 2021 17:33:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 864B16B006E for ; Mon, 5 Apr 2021 17:33:32 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 46D71180ACEE6 for ; Mon, 5 Apr 2021 21:33:32 +0000 (UTC) X-FDA: 77999615064.09.B78B05C Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id 20D3C40002C2 for ; Mon, 5 Apr 2021 21:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=wry8Jt8iN0Mer/EWMWcLYvNntsxmxMJzoHKncgg0YMw=; b=j5tqFDtw4Ez6xytQb1FvHDf3pZ xDE7Axs2HVnmrdwKBV8FeyDDGhNEv7QvdwERMdg4ub6YpCPR/uVl+7GLIxb7ASSMutEg9+P6hSKG+ HrvwVOzB/6mi2+38HIJwSR0b1UCACmXsdKVxFd1RfOmtaigK2J1CteIXCxtF8K3FQel68F2uYetkv /FC4JQype1iNxgL5cJsHvsynb5ay8dVX+sPuTATljSIO68GPnkWPNFjNCDgdea4fbHkvBC7cbtfZh ySIZZGrcHdotRW2PfmjuV2vN79a1USCcMz4fhpEtpZmHmWAiwc6c4lnfHYMblpVUvT3wHY31VhZ6v 9hWcj8YA==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lTWq0-00Btzh-KR; Mon, 05 Apr 2021 21:32:52 +0000 Date: Mon, 5 Apr 2021 22:32:48 +0100 From: Matthew Wilcox To: Dave Hansen Cc: Rick Edgecombe , akpm@linux-foundation.org, linux-mm@kvack.org, bpf@vger.kernel.org, dave.hansen@linux.intel.com, peterz@infradead.org, luto@kernel.org, jeyu@kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, hch@infradead.org, x86@kernel.org Subject: Re: [RFC 2/3] vmalloc: Support grouped page allocations Message-ID: <20210405213248.GN2531743@casper.infradead.org> References: <20210405203711.1095940-1-rick.p.edgecombe@intel.com> <20210405203711.1095940-3-rick.p.edgecombe@intel.com> <971aae01-32a0-3f45-1810-010e3295b1c4@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <971aae01-32a0-3f45-1810-010e3295b1c4@intel.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 20D3C40002C2 X-Stat-Signature: 5ymfqw4zjaeyqadxgs65hmtgxck4mwix Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617658409-194987 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 Mon, Apr 05, 2021 at 02:01:58PM -0700, Dave Hansen wrote: > On 4/5/21 1:37 PM, Rick Edgecombe wrote: > > +static void __dispose_pages(struct list_head *head) > > +{ > > + struct list_head *cur, *next; > > + > > + list_for_each_safe(cur, next, head) { > > + list_del(cur); > > + > > + /* The list head is stored at the start of the page */ > > + free_page((unsigned long)cur); > > + } > > +} > > This is interesting. > > While the page is in the allocator, you're using the page contents > themselves to store the list_head. It took me a minute to figure out > what you were doing here because: "start of the page" is a bit > ambiguous. It could mean: > > * the first 16 bytes in 'struct page' > or > * the first 16 bytes in the page itself, aka *page_address(page) > > The fact that this doesn't work on higmem systems makes this an OK thing > to do, but it is a bit weird. It's also doubly susceptible to bugs > where there's a page_to_virt() or virt_to_page() screwup. > > I was *hoping* there was still sufficient space in 'struct page' for > this second list_head in addition to page->lru. I think there *should* > be. That would at least make this allocator a bit more "normal" in not > caring about page contents while the page is free in the allocator. If > you were able to do that you could do things like kmemcheck or page > alloc debugging while the page is in the allocator. > > Anyway, I think I'd prefer that you *try* to use 'struct page' alone. > But, if that doesn't work out, please comment the snot out of this thing > because it _is_ weird. Hi! Current closest-thing-we-have-to-an-expert-on-struct-page here! I haven't read over these patches yet. If these pages are in use by vmalloc, they can't use mapping+index because get_user_pages() will call page_mapping() and the list_head will confuse it. I think it could use index+private for a list_head. If the pages are in the buddy, I _think_ mapping+index are free. private is in use for buddy order. But I haven't read through the buddy code in a while. Does it need to be a doubly linked list? Can it be an hlist?