From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC48A2580F2 for ; Fri, 12 Jun 2026 04:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781239953; cv=none; b=ePz5sU0gDqNJF1iitOo4WKiEwgjZD8LUVU+D4vqa5pgq1JMPODfwQk8V6BQDYf8Aj/kmZJIokDBBvynrGMKsEpRvh7nCg/bab0yF3jX9l1A6/CrqjmZ+qG0Nsb44hpeScir89GIVaAZIOqChlPajyfuzH+kQu5OY6XtEekPJ1w4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781239953; c=relaxed/simple; bh=s2z91oDHZ54nEf2UcmDuebvGk6E8zvurG/q3csXtzvE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sK2uc3OB5r+wTQyJS7oqAPblYYsjVUFM+RZnQutEXIpYTSQmFf1a14Sj9/ykxkwCoQte/dQENS8VAaWoB7m8b7PN/QMRgziQNIGTpZF8/Tm/4ERBg36aKH9Krm5BYJ3CwxBK1k2605jWPGeKXuYABnUNz9I1aWP0dytuhSQiBbQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Hzo/2U9i; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Hzo/2U9i" 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=N6jDQipfklx8sT9vuAFUiLeqya7GBesDua+a98Rir/4=; b=Hzo/2U9iqHtAMuL4j25AVlPO+T n9gUg1uIzvHpoJoRj8dL06imfPuzi7DzFLZEFX+78LmSdhgT0h5QyTaS59Wp76UKwJdZMy8jKi3xr pyfkg+0IJhm3jeWi3VcMPb9mLDrv3lrRYfcFottGU1x+u6AO1Ar9kLmr2EDBjopiYRPxd7vrS86i0 A53emHdz1ZhB36ec5Rh+myxevklERHhgIH+orUlNUHrqpf03+26AYn+xKX6pb6JbkQAnxv3fKhq7D TlXuFR/AiZNTL0jpG1JPheFZ3lcLSIe7C67Ov84vSIwOn2keZkgle5UC2Id6lAdpaupzcZN7InWvs XPzOhFbw==; Received: from willy by casper.infradead.org with local (Exim 4.99.1 #2 (Red Hat Linux)) id 1wXtsN-000000038tu-12nq; Fri, 12 Jun 2026 04:52:15 +0000 Date: Fri, 12 Jun 2026 05:52:15 +0100 From: Matthew Wilcox To: David Carlier Cc: akpm@linux-foundation.org, syzbot+fd95a72470f5a44e464c@syzkaller.appspotmail.com, David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Kevin Tian , Jason Gunthorpe , Lu Baolu , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: pgtable: protect lockless kernel page table walks with RCU Message-ID: References: <20260612043828.23558-1-devnexen@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260612043828.23558-1-devnexen@gmail.com> On Fri, Jun 12, 2026 at 05:38:27AM +0100, David Carlier wrote: > @@ -434,6 +434,14 @@ static void kernel_pgtable_work_func(struct work_struct *work) > spin_unlock(&kernel_pgtable_work.lock); > > iommu_sva_invalidate_kva_range(PAGE_OFFSET, TLB_FLUSH_ALL); > + > + /* > + * Lockless kernel page table walkers (ptdump, and any other user of > + * walk_kernel_page_table_range_lockless()) dereference these pages > + * under rcu_read_lock(). Wait for a grace period so no walker can > + * still be reading a page we are about to free. > + */ > + synchronize_rcu(); > list_for_each_entry_safe(pt, next, &page_list, pt_list) > __pagetable_free(pt); synchronize_rcu() is rather expensive. Can't you rcu-free the page tables instead? There's an rcu head in struct page.