Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1441252lqj; Tue, 4 Jun 2024 01:18:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVgnDWr9qLSTL7Tqmx2cs3TFWg4y1aIKkMMq/ZMz+MMlgBzHKSg0wtYC0fQSM1hQ8Pe2LK3Q8tctZAa0j8e+GyHduf+zGxejtihX233/Q== X-Google-Smtp-Source: AGHT+IHNqGvl0Ywaj0pBNX8TUn7BnbRiaG9kw7ticrDV8xXosE0myJ0mi8/u+G+D/26eqiEtW0af X-Received: by 2002:a05:6a20:728f:b0:1af:f497:8230 with SMTP id adf61e73a8af0-1b26f1c4cb6mr13558754637.24.1717489133539; Tue, 04 Jun 2024 01:18:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717489133; cv=pass; d=google.com; s=arc-20160816; b=ZOgqRHyOSKftmul5Z2IUg6EGJau52k7JbTsTKZXrlnEhbcDMZnZY3mgDI+xWF/QeX/ Q33Qlee1qioo/xaJn4u8Ae4q03iAQKwVSaol0pQXAvUCXJ3LS1mmWlL2zAddkkQBWvrV wF25BNarjWMcS79Fl3yUmh8FEr6CH/jIj2McujJL7QKdvSJZC2DjQz1j1VyGY6T9NacA ux+T9QzYcu8ZYNn7SurKU3Q/K3t2v+lMHEOhp1SyyvWyCRckHXnjetPqLUaChxWMUOf5 J4Bg0zcFOff+sdctK1Ul91Z4sL6mcokKBRbzNUPRucLLnp+UDeqQTR7PGi2DH2IeNreR 1QlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=5Juv8aSLdzWCWByHFdxbm0E3cWB4jktVxnyQJMvb9DQ=; fh=JzevNBNYLRMR/jXyciMk6YCzSb+Vn+CP/vz/RxV8hW4=; b=C2AIXkODfiCr+SrXe8PAZIVnJkq4rv6LAOYDysvjDe7cv+DTs0vqj2Nc4hC4pHgTW3 FdeMBiVmxm3d1RiWcF0Ng12AEPDTztjtsEOwY2GWf8aMgacMjw4+5JpkTxyXHm3QHhpa FfqVCmvAqhjPLAp/OzFO3HbuPqtiT1INV854/gtV8+nDF7mHMBOnG8+tPQ1H0NgsmSha DE0lbcK7IVYYxwYTSzP4pnQbPjm8z6N1A2gdG43+vjdz6VgxEn1K7MWp8QIDOoq+7wdO 0O1TqqdM2sHaLjUPK6DR/iuX3mJZ7mlg/0UPOHGWHJD8RU5QqNXcBwUKNMng/Ch5g1LU ML7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VZ1tj2rA; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-200237-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200237-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c1c27b8197si1597734a91.40.2024.06.04.01.18.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 01:18:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200237-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VZ1tj2rA; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-200237-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200237-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 16ED2284807 for ; Tue, 4 Jun 2024 08:18:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 087BA1422C3; Tue, 4 Jun 2024 08:18:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VZ1tj2rA" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 C96A4139CFF for ; Tue, 4 Jun 2024 08:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717489128; cv=none; b=ZDET0HQo37wHWT3Y3brIg9yrrMaUYxSPkKdxvTxGXHlajIsJRJMg24+wxUqTKyHqvv0yxC/pv9lJDNitCLXJjj6pdWBf26dc6FcJCgH4vf8jA0kGJxhe0ri8mv4Ej6S6q9hdnn24GMhpcs3y+dkmx0U5YQMj4VD+WjetOdPdBmk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717489128; c=relaxed/simple; bh=t4AlPKcMOvF+J0KAl9cz4z7x0CWBkr/MlJ8H27UTrHo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=K9cElx5FzLEBEI4iV/1ojFc36NjMOJMD/GoixaEzxg8Hx8wcRJT/AlqqnPjUinF7wsiCgtIQjvFV6wFV0nuFQK27TwqVKqjAlV5QR9hcXqYGQsKuPjsY5GnxuxKfiW45YwZwJkxuRs7UflUtUS6PDb7Xvbp1BBwd4X+CVRteZ6U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VZ1tj2rA; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717489127; x=1749025127; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=t4AlPKcMOvF+J0KAl9cz4z7x0CWBkr/MlJ8H27UTrHo=; b=VZ1tj2rAgXtHBalW/UJ8clMAe9qAeuHk2hmk1VIt/5kXaTk0Hpjd16Jc BzVi6hlAec7ObOwbkCybWicAuAJyuBBmUv0DQKwCA23fZMtn7Po5sGbuK Cw4rsb1Ep5+Hx2h69wtRqJXcDhjxcDh9kM+Ttt7ToJsCjKU6SEd/BRUr3 MB3eW//Ucf7qP/5XWUCS08FTCa+SmvfLm5jGhRn3pi/qNESyunEhRzz6g Fx4J4FRpWkhXOAuoMXWBUAo+EA8TLHjTkHEWKd5bZ5CwQEwGclgKn8Nkd w4lyK4LqsnNK2KQ3pJw6RFr7Gt9uEOVU4pNWUzQxbT1MsgcjSNPukYkR3 g==; X-CSE-ConnectionGUID: r0A87p79TICQ5Bsr30+6KQ== X-CSE-MsgGUID: 8wgmX4ukQbOzTUV1Axucmw== X-IronPort-AV: E=McAfee;i="6600,9927,11092"; a="25417177" X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="scan'208";a="25417177" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 01:18:45 -0700 X-CSE-ConnectionGUID: 1zgcUipQRbSslbX3cwqIaQ== X-CSE-MsgGUID: iF7ryx1fQ/KGN7P9cTR90Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="scan'208";a="37286242" Received: from unknown (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 01:18:41 -0700 From: "Huang, Ying" To: David Hildenbrand Cc: Matthew Wilcox , Dave Hansen , Byungchul Park , Byungchul Park , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, akpm@linux-foundation.org, 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 In-Reply-To: <24daabde-300e-4a28-9a1c-9e406b087195@redhat.com> (David Hildenbrand's message of "Mon, 3 Jun 2024 20:00:52 +0200") References: <20240531092001.30428-1-byungchul@sk.com> <20240531092001.30428-10-byungchul@sk.com> <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> <24daabde-300e-4a28-9a1c-9e406b087195@redhat.com> Date: Tue, 04 Jun 2024 16:16:49 +0800 Message-ID: <877cf5ceby.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) 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=ascii David Hildenbrand writes: > On 03.06.24 19:01, 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. > > I'm curious when to set that, though. > > While migrating/reclaiming, when unmapping the folio from the page > tables, the folio is still valid in the page cache. So at the point in > time of unmapping from one process, we cannot simply replace the folio > in the page cache by some other value -- I think. > > Maybe it's all easier than I think. IIUC, we need to held folio lock before replacing the folio in the page cache. In page_cache_delete(), folio_test_locked() is checked. And, we will lock the folio before writing to it via write syscall. So, it's safe to defer TLB flushing until we unlock the folio. -- Best Regards, Huang, Ying