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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 8C4AFC433E0 for ; Mon, 1 Feb 2021 12:28:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 096F164E96 for ; Mon, 1 Feb 2021 12:28:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 096F164E96 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 64D216B0070; Mon, 1 Feb 2021 07:28:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FBEE6B0071; Mon, 1 Feb 2021 07:28:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4EAF96B0073; Mon, 1 Feb 2021 07:28:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id 3613F6B0070 for ; Mon, 1 Feb 2021 07:28:48 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E578B8249980 for ; Mon, 1 Feb 2021 12:28:47 +0000 (UTC) X-FDA: 77769627894.26.honey24_1302b25275c2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id A29541804B667 for ; Mon, 1 Feb 2021 12:28:47 +0000 (UTC) X-HE-Tag: honey24_1302b25275c2 X-Filterd-Recvd-Size: 4629 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 1 Feb 2021 12:28:47 +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=DH1LPO33/0czZh+7CrFmp0uq6mDgTJMK8cCrtZOax5g=; b=iglQvYKCNbZo+ptxfnjYBkQG6K CAQXM+4UdQl4Qnq6Y3ERlHNy+jcKFR9UMD8z5QyElM37REHrDl3QkDUUzgVTjLsjfXCcQqheZ2Xd/ BXA3WyDewu1JYUEKXTeNF+0T4fNOVztnTzXN4fY03x8YvWu18EnjOdtRRzr1/bhd7+1ql0gMYPW7y s5nhHmd4McV0fEojawcFN1W32735Ip3btUSK4f0xNnLLxHOE4T1O+cJDHknIsBQgwqfZxJaEa3bjQ /lF6jjyVMnEwTY0aaGs67A365N3F3V/nARuvO/UmsKbikNEeoyQgFO2gENsyPaqvVKrfs+pnTMxdy kJw12mCQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l6YJo-00Dl5K-2w; Mon, 01 Feb 2021 12:28:36 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 722BE3011FE; Mon, 1 Feb 2021 13:28:32 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 59BE320C8E312; Mon, 1 Feb 2021 13:28:32 +0100 (CET) Date: Mon, 1 Feb 2021 13:28:32 +0100 From: Peter Zijlstra To: Nadav Amit Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nadav Amit , Andrea Arcangeli , Andrew Morton , Andy Lutomirski , Dave Hansen , Thomas Gleixner , Will Deacon , Yu Zhao , Nick Piggin , x86@kernel.org Subject: Re: [RFC 12/20] mm/tlb: save the VMA that is flushed during tlb_start_vma() Message-ID: References: <20210131001132.3368247-1-namit@vmware.com> <20210131001132.3368247-13-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210131001132.3368247-13-namit@vmware.com> 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 Sat, Jan 30, 2021 at 04:11:24PM -0800, Nadav Amit wrote: > @@ -283,12 +290,6 @@ struct mmu_gather { > unsigned int cleared_puds : 1; > unsigned int cleared_p4ds : 1; > > - /* > - * tracks VM_EXEC | VM_HUGETLB in tlb_start_vma > - */ > - unsigned int vma_exec : 1; > - unsigned int vma_huge : 1; > - > unsigned int batch_count; > > #ifndef CONFIG_MMU_GATHER_NO_GATHER > @@ -372,38 +369,20 @@ static inline void tlb_flush(struct mmu_gather *tlb) > if (tlb->fullmm || tlb->need_flush_all) { > flush_tlb_mm(tlb->mm); > } else if (tlb->end) { > - struct vm_area_struct vma = { > - .vm_mm = tlb->mm, > - .vm_flags = (tlb->vma_exec ? VM_EXEC : 0) | > - (tlb->vma_huge ? VM_HUGETLB : 0), > - }; > - > - flush_tlb_range(&vma, tlb->start, tlb->end); > + VM_BUG_ON(!tlb->vma); > + flush_tlb_range(tlb->vma, tlb->start, tlb->end); > } > } I don't much like this, and I think this is a step in the wrong direction. The idea is to extend the tlb_{remove,flush}_*() API to provide the needed information to do TLB flushing. In fact, I think tlb_remove_huge*() is already sufficient to set the VM_EXEC 'hint'. We just don't have anything that covers the EXEC thing. (also, I suspect the page_size crud we have also covers that) Constructing a fake vma very much ensures arch tlb routines don't go about and look at anything else either. > +tlb_update_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) > { > - /* > - * flush_tlb_range() implementations that look at VM_HUGETLB (tile, > - * mips-4k) flush only large pages. > - * > - * flush_tlb_range() implementations that flush I-TLB also flush D-TLB > - * (tile, xtensa, arm), so it's ok to just add VM_EXEC to an existing > - * range. > - * > - * We rely on tlb_end_vma() to issue a flush, such that when we reset > - * these values the batch is empty. > - */ > - tlb->vma_huge = is_vm_hugetlb_page(vma); > - tlb->vma_exec = !!(vma->vm_flags & VM_EXEC); > + tlb->vma = vma; > } And you're also removing the useful information about arch tlb flush functions.