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 07B2DC77B7A for ; Tue, 16 May 2023 14:39:39 +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:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pmBuDvxrvhw9RzJ1b6M4i0hZUXLSDPJRAXrFtj263lI=; b=GJlQpFS6SZKjlw h70vkYlRdOkLMS4MmQixbobU+MgTg9/lc5Kc5fwGT6twN77eGtRfIuuiRmHCxhOJqc17lfDSJvhZs 8TwfZVv3DACfNYpAbndNBWZsuFBC7F+16MqTWYkSMtg2ujba3tNFdw+oEVIv3vF/UVzKJgdYE1Wfu h9GWKfInJK346rQ4wWKE7BrOWwbqfCtwf6z1QRXpupI8eLG6lmQ4patLEKPhUViDEdEYtpXrEeal0 3+AcEcK8no7K7mbySMHIjEsTOKz8P60etiQowSsXJddcVJoh7MeHda2VdhieSwiX34ildYIgCS0zG WAu9FxK7meHOXVFvhUbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pyvpc-0067YN-0o; Tue, 16 May 2023 14:39:16 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyvpb-0067Y5-1o for linux-arm-kernel@bombadil.infradead.org; Tue, 16 May 2023 14:39:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:Message-ID: Date:References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=H+s4L31no8WNf+7iGWHjMBGPbaqtRjAg6FlaaNkpyl4=; b=EsNExd1KER97z/hU+Awd/bQI+G l7M1gw+lEL4ZPsGDWAit+gww4miggKrRXLYzX/nF54AEUF4ELwUkWKX/hike0YyyiBdHQ3bWDiDBm sH/tCqksDjHbHG/hkF5Rj5Y2GE6Xs2evqIfV2sZAwEPO2+r2+ZBxZTFMW3lSBvCs8wqUa1EfLnIV0 ebG6I4TvZVn3Q5dU7oHs8nX7/RZqmxo6fyg1YlaYY5KTyihP4SsvD2nZ7uC0OAunBwgp/9Q5UmwhM /Ff+B9epWTz4ptXSZRqz+hlXxM9S0jjC7ysM+Uf4F0e7UuezT2Ctbh3wNjd0lVX5iNZYH3Z1hPG5b M39MaFeg==; Received: from galois.linutronix.de ([193.142.43.55]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyvpX-00C8Dh-2S for linux-arm-kernel@lists.infradead.org; Tue, 16 May 2023 14:39:14 +0000 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684247939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=H+s4L31no8WNf+7iGWHjMBGPbaqtRjAg6FlaaNkpyl4=; b=toWbGUFweo5iqHaVmOtwmnjkNOg7140331MwncCz0l4l+C/bdxBy3brnNdFoM+5rEI/dHu kO2M6dnZLM4P/offtRftLnlXblxCJXtXDSYS3q4XZkSVP3l4L8BbdXylSnE90oAmiKYX8J 8M2eh0FbQ8CuY9W3v7vCpv5sSKPppSprQZBb+FE1KrNwu0bCmJfQNxOYJ8zsMoaGSNYnJt dL3m/wGs6UYXZNPXrTQWONLMdmKHV6g9UjZ09suSNcX43eGfVv+AeL6zz9rNurwiPDrlbg Bsig6Mi6tH5nbGYLoFOcN+vKWnQNCMyfhPmgBsdW39dC6YWm6Q+384yEkjSuIA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684247939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=H+s4L31no8WNf+7iGWHjMBGPbaqtRjAg6FlaaNkpyl4=; b=CUs8QWKgDH4pbXSoNYBYIG8gFa9dR0xc123eajymPTA2A5GfDu3AwWO4EE0wNXkl3X408c +owl8kSLb3EeQwAw== To: Uladzislau Rezki Cc: "Russell King (Oracle)" , Andrew Morton , linux-mm@kvack.org, Christoph Hellwig , Uladzislau Rezki , Lorenzo Stoakes , Peter Zijlstra , Baoquan He , John Ogness , linux-arm-kernel@lists.infradead.org, Mark Rutland , Marc Zyngier , x86@kernel.org Subject: Re: Excessive TLB flush ranges In-Reply-To: References: <87a5y5a6kj.ffs@tglx> <87353x9y3l.ffs@tglx> <87zg658fla.ffs@tglx> <87r0rg93z5.ffs@tglx> <87cz308y3s.ffs@tglx> <87y1lo7a0z.ffs@tglx> Date: Tue, 16 May 2023 16:38:58 +0200 Message-ID: <87o7mk733x.ffs@tglx> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230516_153911_975267_A52CF474 X-CRM114-Status: GOOD ( 13.71 ) 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 Tue, May 16 2023 at 15:42, Uladzislau Rezki wrote: >> _vm_unmap_aliases() collects dirty ranges from per cpu vmap_block_queue >> (what ever that is) and hands a start..end range to >> __purge_vmap_area_lazy(). >> >> As I pointed out already, this can also end up being an excessive range >> because there is no guarantee that those individual collected ranges are >> consecutive. Though I have no idea how to cure that right now. >> >> AFAICT this was done to spare flush IPIs, but the mm folks should be >> able to explain that properly. >> > This is done to prevent generating IPIs. That is why the whole range is > calculated once and a flush occurs only once for all lazily registered VAs. Sure, but you pretty much enforced flush_tlb_all() by doing that, which is not even close to correct. This range calculation is only correct when the resulting coalesced range is consecutive, but if the resulting coalesced range is huge with large holes and only a few pages to flush, then it's actively wrong. The architecture has zero chance to decide whether it wants to flush single entries or all in one go. There is a world outside of x86, but even on x86 it's borderline silly to take the whole TLB out when you can flush 3 TLB entries one by one with exactly the same number of IPIs, i.e. _one_. No? Thanks, tglx _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel