Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp53169lqp; Mon, 10 Jun 2024 18:10:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXeigjOS2sPG5x557eSAoRZIUXQjVGhGiOiOTGqcwB/i+1W1cZa5MQoziL7W5GJatQJy7X4UQ48dbD8PPmfXJwwTGvDE2oAzsPLpTJI4g== X-Google-Smtp-Source: AGHT+IHD2VLAMzaTVX4ov/NsLzPXGWIa8nlFfKNmW8wAP4IXYIfswMm662/TrkSdj4GK3VT2mhHU X-Received: by 2002:a17:902:d4c1:b0:1f6:7212:760a with SMTP id d9443c01a7336-1f6d021805amr126332305ad.0.1718068249341; Mon, 10 Jun 2024 18:10:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718068249; cv=pass; d=google.com; s=arc-20160816; b=lK+3e3UUbTwdBPNGZSiCbg+IAHB6P5u/PeLZKMMOSf0BXs/HWUpWF+zeLDwThwZjsU b/VliwV6CDJ+6DmnjQFzRhko4cxbf2rSLkX0NVt+b4+EFE9WRQTWLyzd5E0G0bnwhOMU C19/5RQUSQJrXY1+WqAaBwBK0zna3aeLRVmgV8AlioiZtmhaCshN9u1I3/WApHtdl/lf 7TNEtfPKUTr+590oDqNZOq44igqxNFPtmLJdVXTcAbtUi/OqHo8dcH35B/j0GTBgJfSF XsPXMcMVtabNTG8oXxMtme9fm+oo6CmoVC8NYQNNZTYklkHYCzg7qOXrczVjqLeNg3P5 s2IA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=RSmsI6OS/o1c+x+yAM88UzoDhpV6UQmOqV7gZI0xHTA=; fh=cwlGqaSxE7NJMlLwgeLg0Ksc47rZg93Uz/svERFmlpA=; b=Oc5PDMjYUO8zNqu3Gk2Icha5bwpQEKDZCQ5Ky8GvVECFuIUWEl49vOtQIg/ui2U+xU HHsL2F6UYG0mZV/1JuVksCpFE3HrcfJzJURfkGjuA8vYF0OyYoLdexqU5Xgryy5KDHV5 pMt96Ss7U+0sivcoJZhMleeD7FfRUEso25g5VSNRGUQDMnDaNslEuEzdSm9qctpQ7U+4 VECruD2NvYlwZ8OzZnVVm2LJE67j5C30PyHoq74Bf7K0LnD5xG/+aLOzGzm4QXPGI5KI ko9lgbNI+oxqBSfhbu3I9L2b21g5qrKFyqvWnCGpjTWhkWW6eBHFGXjAOHeBjMN1cgg1 hmBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-209148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209148-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7e4a45si50025875ad.346.2024.06.10.18.10.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 18:10:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-209148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209148-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 88A102822C1 for ; Tue, 11 Jun 2024 01:10:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D0971173F; Tue, 11 Jun 2024 01:10:44 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 816B710A1C for ; Tue, 11 Jun 2024 01:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718068243; cv=none; b=fZLnliqwJH/qMYujuTlewvjXFpMF84HHN1FB0A9QLRYDEk0wwfGgWtDwoAdL4pR/KGMChZfboZjKRLQmFJ9V5KQDunWOOCld3jrq07DHfMMXWpDsYkr1UNDtH4GQzNEAtjMhvbjqqnGv0mSlffiyKGTKcy9tSSVt/TPsUeI4pLk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718068243; c=relaxed/simple; bh=jRaCH5nIF7gKU8dxlxss/0Oj+TUSsI7RXOAmfrxgvuQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iUUfipeQzdjYnPJCOlb3L/8wbBGcOlyiWE1w9jXk2p2YZpYyK1KKuVi2y6JGV70iYiDCu4EQbSzDGIzSg4YfpBDBYCQXnQVawRyaNT/CjVv4K3SEH0kjNAqS5LSLhm3TM+7Y/6cklMWde5S+vIxvHIcg+RSYE6bMVVa1LEfDey8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d6dff70000001748-3f-6667a0816763 Date: Tue, 11 Jun 2024 09:55:23 +0900 From: Byungchul Park To: Michal Hocko Cc: Matthew Wilcox , Dave Hansen , David Hildenbrand , Byungchul Park , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, akpm@linux-foundation.org, ying.huang@intel.com, vernhao@tencent.com, mgorman@techsingularity.net, hughd@google.com, peterz@infradead.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, rjgolo@gmail.com Subject: Re: [PATCH v11 09/12] mm: implement LUF(Lazy Unmap Flush) defering tlb flush when folios get unmapped Message-ID: <20240611005523.GA4384@system.software.com> References: <26dc4594-430b-483c-a26c-7e68bade74b0@redhat.com> <20240603093505.GA12549@system.software.com> <35866f91-7d96-462a-aa0a-ac8a6b8cbcf8@redhat.com> <196481bb-b86d-4959-b69b-21fda4daae77@intel.com> <20240604003448.GA26609@system.software.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: User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsXC9ZZnkW7jgvQ0gytrRS3mrF/DZvF5wz82 i08vHzBavNjQzmjxdf0vZounn/pYLC7vmsNmcW/Nf1aLo52bmC3O71rLarFj6T4mi/t9DhaX Dixgsjjee4DJYv69z2wWmzdNZbY4PmUqo8XvH0BdJ2dNZnEQ9vje2sfisXPWXXaPBZtKPTav 0PJYvOclk8emVZ1sHps+TWL3eHfuHLvHiRm/WTzmnQz0eL/vKpvH+i1XWTy2/rLzaJx6jc3j 8ya5AP4oLpuU1JzMstQifbsErow1P9cxFhwRrNjU3MLawHiQt4uRk0NCwETiz/7HTDD2j8Nn gGwODhYBVYkr7eIgYTYBdYkbN34yg9giAkoSXZt3snUxcnEwC/xnlvgx7xgbSE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WQjNCxiZVzGKZOaV5SZm5pjqFWdnVOZl Vugl5+duYgTG3rLaPxN3MH657H6IUYCDUYmH98THtDQh1sSy4srcQ4wSHMxKIrxnYtLThHhT EiurUovy44tKc1KLDzFKc7AoifN6hacmCAmkJ5akZqemFqQWwWSZODilGhg7KlXuf3J6L5x2 TVVA9YHfacl3xg7GKf76T0TzzdOW2feydeyRPZpT91xH2Znz+yMlkc3z/XzXxT/00fn2+irH 4ftrlr7+eXIlS++7wG3X93K4Pj9/wPJuyfzgun+TkmNN/m1uYjq//eMfY4+jh82m3BaPMjX5 dLrNi+X8E86k7yy+TyPmy8xXYinOSDTUYi4qTgQAvvh5wrkCAAA= X-CFilter-Loop: Reflected On Mon, Jun 10, 2024 at 03:23:49PM +0200, Michal Hocko wrote: > On Tue 04-06-24 09:34:48, Byungchul Park wrote: > > On Mon, Jun 03, 2024 at 06:01:05PM +0100, Matthew Wilcox wrote: > > > On Mon, Jun 03, 2024 at 09:37:46AM -0700, Dave Hansen wrote: > > > > Yeah, we'd need some equivalent of a PTE marker, but for the page cache. > > > > Presumably some xa_value() that means a reader has to go do a > > > > luf_flush() before going any farther. > > > > > > I can allocate one for that. We've got something like 1000 currently > > > unused values which can't be mistaken for anything else. > > > > > > > That would actually have a chance at fixing two issues: One where a new > > > > page cache insertion is attempted. The other where someone goes to look > > > > in the page cache and takes some action _because_ it is empty (I think > > > > NFS is doing some of this for file locks). > > > > > > > > LUF is also pretty fundamentally built on the idea that files can't > > > > change without LUF being aware. That model seems to work decently for > > > > normal old filesystems on normal old local block devices. I'm worried > > > > about NFS, and I don't know how seriously folks take FUSE, but it > > > > obviously can't work well for FUSE. > > > > > > I'm more concerned with: > > > > > > - page goes back to buddy > > > - page is allocated to slab > > > > At this point, tlb flush needed will be performed in prep_new_page(). > > But that does mean that an unaware caller would get an additional > overhead of the flushing, right? I think it would be just a matter of pcp for locality is already a better source of side channel attack. FYI, tlb flush gets barely performed only if pending tlb flush exists. > time before somebody can turn that into a side channel attack, not to > mention unexpected latencies introduced. Nope. The pending tlb flush performed in prep_new_page() is the one that would've done already with the vanilla kernel. It's not additional tlb flushes but it's subset of all the skipped ones. It's worth noting all the existing mm reclaim mechaisms have already introduced worse unexpected latencies. Byungchul > -- > Michal Hocko > SUSE Labs