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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0105FC35274 for ; Fri, 15 Dec 2023 13:46:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 84F656B0208; Fri, 15 Dec 2023 08:46:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FE606B020A; Fri, 15 Dec 2023 08:46:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C5056B020C; Fri, 15 Dec 2023 08:46:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5C82C6B0208 for ; Fri, 15 Dec 2023 08:46:08 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2A40D160D6F for ; Fri, 15 Dec 2023 13:46:08 +0000 (UTC) X-FDA: 81569176416.20.22F065B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id 8D3E21C001C for ; Fri, 15 Dec 2023 13:46:04 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=QPzsLg6d; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702647965; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=m3TpaISKdTfci96+P+Jf+SMvxKNA9yGZkAHX2szxtjI=; b=jK8XoMPVN88Wbcyb4bDl1Wr533HwCq+hFigxMjuysL7Hcq4Jyea6eJjMF6LiE4lHE3tfQM DcFZa2ecyxK/joXeK3zqSGru2KcNlcixjtVquh2slh3rlTibAoDU7RqfWk+4bYAFJtg9Yz J5pdxvgiF1y3y4igm5gxAkiC8xEpivA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=QPzsLg6d; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702647965; a=rsa-sha256; cv=none; b=LFVBW3i/PP2QH6VIk9UZTlLt6o8XH9lsLRqzWo/dFaaa6Q3TRBMpRe7/PVV8JFLN8DE6eG 5uOLftgAKqcsyVAAa1rUZ8gBU9Jw9S/UxlvvyH5j1jpbHManzR/iLwSLdw4CaRXozKfIHk 2SAWFoCDhLc1Ryd9eZGHmOO6RcPuFw0= 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=m3TpaISKdTfci96+P+Jf+SMvxKNA9yGZkAHX2szxtjI=; b=QPzsLg6deVq+SoZS+zr8iDREAY JwRlwRQoNRFLe8A/+GXPJ2CxYCiWnxBEerMdkyFZgXIPHUnodHHoQlgHbbmbtmny0KpoUhyHgZdRf vOeCu3P5V2xPZpABCU8M1D2bXX1s5m00oeJ+AePkTVt1I6AuA0UohcO+BBiqq/thpJmOhcQd++w5a wjERoWTKmZVuMP/6vQgK2LzAmKfYQBvX7wKzpIgw/aqLZzHHJFhxqDstyUhsm7I06mK3wktfJSgpq Ih99tYqsUixHO5RBZXfZuyQrfsA3+T4KT7b+4QrTcIIX0US0JtegEUCNXvy5Co5q8OsL/+IqzHIcC 6CBa/xAQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rE8Vm-00HSci-A6; Fri, 15 Dec 2023 13:45:54 +0000 Date: Fri, 15 Dec 2023 13:45:54 +0000 From: Matthew Wilcox To: Jianfeng Wang Cc: akpm@linux-foundation.org, tim.c.chen@linux.intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm: remove redundant lru_add_drain() prior to unmapping pages Message-ID: References: <20231214222717.50277-1-jianfeng.w.wang@oracle.com> <1610bab2-78fd-4010-9f50-486952f942e6@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1610bab2-78fd-4010-9f50-486952f942e6@oracle.com> X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 8D3E21C001C X-Stat-Signature: hfdmc9meh8ouzrsj5s8fhahbgqeqgsy4 X-Rspam-User: X-HE-Tag: 1702647964-130200 X-HE-Meta: U2FsdGVkX1+PxGPioryhIL1yHTrVoa4vXEkoj9NGY/rBDxKAyhsuQoiX2cQbeDFEuVoKVrKEYdpX6vr+EN8oq/bLxOavG4opYH/KyQyKSqz1DeepV2j4fCt/G130rxcBvNDiP2XDqeb35EaSGyJv05i+gG9oR+N9g9aUAxagafqbYgtmi3tlIqECDFlf7TUPCl2NCnZCujf95SfFh/tB6vTMFZ9GcBpReJ/PmvS+xH9hLXgomh6RT/UdOBH/DZDLrocHb2JcR4Oa5+2v+BimvoCpAXaZhFAncSxvFQwUZatPiodzbI1e9fDStiMsbx0pARLzt2KlBwRuPIXuFo59NYueLKPBMGHWSbJ2sk0PpPJaQG3M8fkb45W8EUpp1f/ukkdfGG3hmvJ467607e9aBLeRRVbBTzOpoFlfKhsZphOvNxzWMQn7IK3xUivCQeLSadHg8zh0GDmDMIQfBenf41XQINrxAdq77uGbJVvRRRjAVvkGUY0Zbo0qKGBzDEpBtHlALwAFcLJ46JgJDjLiiUe31/rZD7I/ce52caveMMjZzj46gCh73IPAlbcl7RB+7u7pqt6480FvrDvNMXRpqSLtQT/5gWb+mB57g97uDruftzt4vsl8iUyHaTVPsvyljt7XfKT3Mqh5QbzrO/mUAU50CC1sHizFeBpPrcrw1tjNej8zmHNXTp2e8Ey3t6xRc2eoog9YABI98hNwBah2yvi7V4wd5GDxVqe3/BpYLVZnlVMHjNEwVRIJCtqiNbtceIxqUgO7GTB3n/LNbS+vFe1YI4Pi+6U+z0xlkjUdu8zKIA+r8fFOxbCVLPqI+j1QAjbOcDbH/58uw/keyquK6f6Wm8SIiGjm8lgkuwp4CKhzxZYE0ZDAmEDAsOQveip7hPSanWQ4e4k6qxTMrEwL/1Ye514YugnRkRUYDGCCc+nlDR9IFCzs+xeq6hvWEQMIOM+jR0xDSpepWoBgpMd 29BxcR5A ntxQycwX/2weIVfPuryRwpfyir6PX4ZqCzg+17pi2NREFYl474tCkUpsiVzt8dX9JEosaZRPpFvLlLk5lDLTYkw9L6V3m5rE6qPAwyzyI4Y9qNebKxHF4VUvDtorch048VH8i1x1M5ZPkfv6/CqaSeAkTVuLnq/xdlaJ9Bhfu1ScZelYA5bWIjcdaGQ== 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: List-Subscribe: List-Unsubscribe: On Fri, Dec 15, 2023 at 12:48:10AM -0800, Jianfeng Wang wrote: > On 12/14/23 3:00 PM, Matthew Wilcox wrote: > > Shouldn't we put this in __tlb_gather_mmu() which already has the > > CONFIG_MMU_GATHER_NO_GATHER ifdefs? That would presuambly help with, eg > > zap_page_range_single() too. > > After looking at different use cases of tlb_gather_mmu(), I feel it is > questionable to move lru_add_drain() into __tlb_gather_mmu(). There are > two use cases of tlb_gather_mmu(): one for unmapping and releasing pages > (e.g., the two cases in mmap.c); the other one is to update page table > entries and flush TLB without releasing pages (e.g., together with > mprotect_fixup()). For the latter use case, it is reasonable to not call > lru_add_drain() prior to or within tlb_gather_mmu(). > > Of course, we may update tlb_gather_mmu()'s API to take this into account. > For example, we can have tlb_gather_mmu_for_release() for the first case > and tlb_gather_mmu() for the latter. I'd like to have your opinion on this. Yes, I like this idea. You're right that there's no need to drain the lru lists for the other use case, so it makes sense to have two APIs.