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 CC4181F76D6 for ; Wed, 18 Dec 2024 16:45:34 +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=1734540336; cv=none; b=EaiWcbqGPOnG9ki5rY2PSp77sFketYm0IJ2MAFM1PMmxzXRMVVamQ2RvboqnlEiAjFAX8GiHqOncbVp3lilHsf3jnDLLI6kpsLeF2ElIFb6zZV4MMqjwgqnrj91G/lHcem3Gt9hBG42SJVy4pZdYz162pSCaQ245+hg+bXvmOJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734540336; c=relaxed/simple; bh=D5QonYce3p+9h8emR1hgiE360ZC0i/J5RtPECPYYAXM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=k60CnLgqwFmBjonS9rNYgk9gvMl8LhF0k1PyeYGqhrLwPvuxnCkoB/RkG5WF3t098vjo59pZRSoS40ecS5mu9g+i1wsqzB6iIZI07B7e51eZ/ifvaLL0kIJbGluc/ac+c1iyHQLJ6jmWY4MDEOG0xF4PJovXxkriywtQWVHzTMs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Y50Yqyve; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none 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="Y50Yqyve" 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=q9h1y8HNwaX+erCAdQRplaoG7Vs3tlrGQ/uNEMNyDdY=; b=Y50YqyveEkhyROAq+uqLMYCfT5 9I37rSTg+XkF9F6ymf4IBIlKLFmVgHg1ype2zNE5xfUh8eOTqTUy+SHFxsYAywEHXHLVJmNs4quYZ ta5gngwSvWTfHRnvHTjRkvS4xh48xjwR95OCjFr6IuWgwoblUE0u1kXbfBeNUn/0/hVjxFk+DyxNT mk5Uy/sLeiBFbNF6fZIL57dZqBXZlfaCYc1sLkQV0/SjRn1mG23LWOBw6UmCRVSJVRnhuRVyJofOt 2UB51LNPzCJ8tnuL/HAmLKZcYj3M9RscrjloUx0d/cRM6l5WNs+jYGd/kWQJAV3Vy0CJCu1zUXiYw pyqQIK4w==; Received: from 77-249-17-89.cable.dynamic.v4.ziggo.nl ([77.249.17.89] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tNxAm-00000000IIl-14Qq; Wed, 18 Dec 2024 16:45:21 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 7AA9B30031E; Wed, 18 Dec 2024 17:45:20 +0100 (CET) Date: Wed, 18 Dec 2024 17:45:20 +0100 From: Peter Zijlstra To: Qi Zheng Cc: tglx@linutronix.de, david@redhat.com, jannh@google.com, hughd@google.com, yuzhao@google.com, willy@infradead.org, muchun.song@linux.dev, vbabka@kernel.org, lorenzo.stoakes@oracle.com, akpm@linux-foundation.org, rientjes@google.com, vishal.moola@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 14/15] mm: pgtable: remove tlb_remove_ptdesc() Message-ID: <20241218164520.GK2354@noisy.programming.kicks-ass.net> References: <79b20df78eb81a9cd07e3048f2d4d63d98759b4a.1734526570.git.zhengqi.arch@bytedance.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: <79b20df78eb81a9cd07e3048f2d4d63d98759b4a.1734526570.git.zhengqi.arch@bytedance.com> On Wed, Dec 18, 2024 at 09:04:50PM +0800, Qi Zheng wrote: > diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h > index 7052780740349..fba11949dd2ea 100644 > --- a/arch/s390/include/asm/tlb.h > +++ b/arch/s390/include/asm/tlb.h > @@ -86,7 +86,7 @@ static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, > tlb->cleared_pmds = 1; > if (mm_alloc_pgste(tlb->mm)) > gmap_unlink(tlb->mm, (unsigned long *)pte, address); > - tlb_remove_ptdesc(tlb, pte); > + tlb_remove_table(tlb, pte); > } > > /* > @@ -105,7 +105,7 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, > tlb->mm->context.flush_mm = 1; > tlb->freed_tables = 1; > tlb->cleared_puds = 1; > - tlb_remove_ptdesc(tlb, pmd); > + tlb_remove_table(tlb, pmd); > } > > /* > @@ -123,7 +123,7 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, > tlb->mm->context.flush_mm = 1; > tlb->freed_tables = 1; > tlb->cleared_p4ds = 1; > - tlb_remove_ptdesc(tlb, pud); > + tlb_remove_table(tlb, pud); > } > > /* > @@ -141,7 +141,7 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, > __tlb_adjust_range(tlb, address, PAGE_SIZE); > tlb->mm->context.flush_mm = 1; > tlb->freed_tables = 1; > - tlb_remove_ptdesc(tlb, p4d); > + tlb_remove_table(tlb, p4d); > } > > #endif /* _S390_TLB_H */ AFAICT these are all virtual addresses (still) > diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h > index 8d6cfe5058543..583e95568f52b 100644 > --- a/include/asm-generic/tlb.h > +++ b/include/asm-generic/tlb.h > @@ -211,7 +211,7 @@ struct mmu_table_batch { > #ifndef __HAVE_ARCH_TLB_REMOVE_TABLE > static inline void __tlb_remove_table(void *table) > { > - struct ptdesc *ptdesc = (struct ptdesc *)table; > + struct ptdesc *ptdesc = page_ptdesc((struct page *)table); And here you're assuming they're page pointers. > pagetable_dtor(ptdesc); > pagetable_free(ptdesc);