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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88A44C4828D for ; Wed, 7 Feb 2024 14:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N9pdUmjPrkGS1vdpggvaJYxd99D0ELmMDW+R+UL1ssU=; b=VIAAwCK2hrdW99 4bs1Kibq+QoRAfIT4CQx8EI7pPauq0+GmJ157JxxuhemEXVgkVrTB8N6BeXWeaPLW0enw0OpXNpfT dq5bgUXfgwRv4kGmzmPzrbFFZJzWqvoQsgrWCTzCQ5E49sX6n3DkEDp+q0IIGcbavWRasWlDTzjWM DOrAEH3LL6poaMF8P+XPAyGf+5AmslEKtJ46dUzVtbcR1tcPryNPnYZAmixi9ycVsi432sJ6IHofi S3loBF3VW5hWHzH+tAtIu6u/jmTMvHnTVoBo0qWCHHf73yylWmzXLwEgCV37RgF8xTjUAnPCEU5k2 4xfV3gmsJAjyzg4KqeMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXik4-0000000AseJ-2SYC; Wed, 07 Feb 2024 14:17:36 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXik2-0000000Asdz-2vrN for linux-arm-kernel@bombadil.infradead.org; Wed, 07 Feb 2024 14:17:34 +0000 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=6nXIcLmaWrCikPStJ3sC7+E3lnqfPQhTFLM5Qd6/v+g=; b=cdkGZZ6Hx+vVpgO8vYvlPMpbTQ K/alL+Cx5LLR6Ap1iO9ffjd5Zemo3g7Yxeb+FVj0ctQakDgQOQmp/0dejt+dxj2jLyp4yuy3JsQSl SWiQnhSIOO2KsCP0NzIQXMSuEDLhc6pNebUYzIpudZECGPlJ3SceMr2VSHPYwtJ46sjub2r/tqNF4 kKUBc3VzfT3CfuU20g2Pv1nkSocvbqOg+93mDqfoNVrSMFrUn1qltiUiiojz4RTO5nha4YNl/qpvk O5E1WZOrF1yaNXlVVP3qW6qg/J3DYr2vx8qLnzEzHPWkFOMOSXNAgyA4kg3QqHRKbeqa952oZ5/SU qJtjatFQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXijz-0000000FJjg-2Fbc; Wed, 07 Feb 2024 14:17:31 +0000 Date: Wed, 7 Feb 2024 14:17:31 +0000 From: Matthew Wilcox To: Will Deacon Cc: Nanyong Sun , Catalin Marinas , muchun.song@linux.dev, akpm@linux-foundation.org, anshuman.khandual@arm.com, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 0/3] A Solution to Re-enable hugetlb vmemmap optimize Message-ID: References: <20240113094436.2506396-1-sunnanyong@huawei.com> <20240207111252.GA22167@willie-the-truck> <20240207121125.GA22234@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240207121125.GA22234@willie-the-truck> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 07, 2024 at 12:11:25PM +0000, Will Deacon wrote: > On Wed, Feb 07, 2024 at 11:21:17AM +0000, Matthew Wilcox wrote: > > The pte lock cannot be taken in irq context (which I think is what > > you're asking?) While it is not possible to reason about all users of > > struct page, we are somewhat relieved of that work by noting that this is > > only for hugetlbfs, so we don't need to reason about slab, page tables, > > netmem or zsmalloc. > > My concern is that an interrupt handler tries to access a 'struct page' > which faults due to another core splitting a pmd mapping for the vmemmap. > In this case, I think we'll end up trying to resolve the fault from irq > context, which will try to take the spinlock. Yes, this absolutely can happen (with this patch), and this patch should be dropped for now. While this array of ~512 pages have been allocated to hugetlbfs, and one would think that there would be no way that there could still be references to them, another CPU can have a pointer to this struct page (eg attempting a speculative page cache reference or get_user_pages_fast()). That means it will try to call atomic_add_unless(&page->_refcount, 1, 0); Actually, I wonder if this isn't a problem on x86 too? Do we need to explicitly go through an RCU grace period before freeing the pages for use by somebody else? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel