Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5106700yba; Mon, 13 May 2019 05:34:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwR9ze3tr+bTY3oEQ48xAp66WvQU7WV7ztQI47x4cnrlwkyp44X3zDq9PrJyoGs0E2GY1ov X-Received: by 2002:a17:902:b407:: with SMTP id x7mr31153568plr.28.1557750895989; Mon, 13 May 2019 05:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557750895; cv=none; d=google.com; s=arc-20160816; b=l9DZGCioECpfctTqQyrc0IOw9B31exkEBJRlq8WfcGgXyDKff/TC7fAXziCimVLUg4 iLQa/IMSFn7s6c7jn5/a0uI7SSB3oYhZ4Wl2VzEKJcwWm9YeTTDMQrtrexbL/yqt1K9+ hJcfVoCgxHxz/NiRQLZdFStbic8RzSIqHLQ1L7O4tVapQrR0TXqvbXL7+r38lEgKe29a UK+qbxQO/5VEcblx2z+kfuPrAWMzMgcMYzmpBUgCfwBJOO0T0wxgFSHtb/tgLH6Zxnvo 9B0qkI8GsxiLWkJYelTCrZK7D0EO5rdIxo2Ytn2clClK788m9aUi7DuZIL8oqxBH2Obd m6Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QlLTDpUw3LQEBrJUE4pLazn/f1TqZvICJfFNqlHW/BQ=; b=c23K3kXTCx5LMzdTyhiUBC/JlP8BVs3oRHffJNnkE3p0FXYcapMupGu54UpmOLtNb7 LGk5lbKMHd/1swDuEQbQFFeu03c6zCe1Ho1xnJoamPhrBWjjIDy0+AesI/xJRNC6baX6 dE9WpELN3RdMoZndE/T5gwb85Ao9l6PCCMN8bz4aFdPONZ2guPYtuwcCUVm/wKApiin/ +nIBornYjq1bCiExHQ3b3HxOYk3m8++HMxKYrOEi5bI7Fc/jz13i+oumHjwyS4p84uE4 4deWTMnN5ng43TMXSZC4px7lm2xSXwOGxMRfdv0sVomc7MhtmCgzyTzr99Fr6WgyXsRp pYCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=IwWEzplk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si15951710pgc.310.2019.05.13.05.34.39; Mon, 13 May 2019 05:34:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=IwWEzplk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728701AbfEML13 (ORCPT + 99 others); Mon, 13 May 2019 07:27:29 -0400 Received: from merlin.infradead.org ([205.233.59.134]:53676 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726866AbfEML12 (ORCPT ); Mon, 13 May 2019 07:27:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QlLTDpUw3LQEBrJUE4pLazn/f1TqZvICJfFNqlHW/BQ=; b=IwWEzplkAkvkiV39U9/PKkoJb Mbh2qFemubE06kI3RAvtqVE74136gc9EF11rwqkOIOqh3/Zllt/rNxayUsNYx6Yj8YS0buszvdTIM Oq52Pqhn1KbDNJdTxbEQ422JPZew+5gXySaIlAa/rb9C1GdAjiksksYWL51W/r5Hso54fqJLiFOl4 2M4jC9VETnBTqBXWBiKdZWNGoC6oDaUtY6skxz7RpfawLsiEltTDWKsYd8p7rf9LOdhi6mI5GoZBb mvTgrr+48M9/o80HvkCIe6Jk4fUIuU/z1rUoPxpqQo3zTyOR4J6/ryDq//uAqZ1NGHDLwtnhHKe+T dPYpqSBng==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hQ96x-0006dy-89; Mon, 13 May 2019 11:27:16 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7CB452029F87D; Mon, 13 May 2019 13:27:12 +0200 (CEST) Date: Mon, 13 May 2019 13:27:12 +0200 From: Peter Zijlstra To: Nadav Amit Cc: Yang Shi , "jstancek@redhat.com" , Andrew Morton , "stable@vger.kernel.org" , Linux-MM , LKML , "Aneesh Kumar K . V" , Nick Piggin , Minchan Kim , Mel Gorman , Will Deacon Subject: Re: [PATCH] mm: mmu_gather: remove __tlb_reset_range() for force flush Message-ID: <20190513112712.GO2623@hirez.programming.kicks-ass.net> References: <20190509083726.GA2209@brain-police> <20190509103813.GP2589@hirez.programming.kicks-ass.net> <20190509182435.GA2623@hirez.programming.kicks-ass.net> <04668E51-FD87-4D53-A066-5A35ABC3A0D6@vmware.com> <20190509191120.GD2623@hirez.programming.kicks-ass.net> <7DA60772-3EE3-4882-B26F-2A900690DA15@vmware.com> <20190513083606.GL2623@hirez.programming.kicks-ass.net> <20190513091205.GO2650@hirez.programming.kicks-ass.net> <847D4C2F-BD26-4BE0-A5BA-3C690D11BF77@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <847D4C2F-BD26-4BE0-A5BA-3C690D11BF77@vmware.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 13, 2019 at 09:21:01AM +0000, Nadav Amit wrote: > > On May 13, 2019, at 2:12 AM, Peter Zijlstra wrote: > >> The other thing I was thinking of is trying to detect overlap through > >> the page-tables themselves, but we have a distinct lack of storage > >> there. > > > > We might just use some state in the pmd, there's still 2 _pt_pad_[12] in > > struct page to 'use'. So we could come up with some tlb generation > > scheme that would detect conflict. > > It is rather easy to come up with a scheme (and I did similar things) if you > flush the table while you hold the page-tables lock. But if you batch across > page-tables it becomes harder. Yeah; finding that out now. I keep finding holes :/ > Thinking about it while typing, perhaps it is simpler than I think - if you > need to flush range that runs across more than a single table, you are very > likely to flush a range of more than 33 entries, so anyhow you are likely to > do a full TLB flush. We can't rely on the 33, that x86 specific. Other architectures can have another (or no) limit on that. > So perhaps just avoiding the batching if only entries from a single table > are flushed would be enough. That's near to what Will suggested initially, just flush the entire thing when there's a conflict.