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 70C6CC433F5 for ; Wed, 9 Feb 2022 14:29:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E566A6B0074; Wed, 9 Feb 2022 09:29:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E061E6B0075; Wed, 9 Feb 2022 09:29:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF5AC6B0078; Wed, 9 Feb 2022 09:29:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id BF27C6B0074 for ; Wed, 9 Feb 2022 09:29:13 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 890288F6F9 for ; Wed, 9 Feb 2022 14:29:13 +0000 (UTC) X-FDA: 79123473786.17.A913B8E Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id 97CF1120007 for ; Wed, 9 Feb 2022 14:29:12 +0000 (UTC) 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=eIF08KcMpl5r29rPiQe9+6ZkSSpvO+hinKiqWMtDBSw=; b=oj44LeKt1qxycyFeTCQRMXiQqd 4VhwfEU3oOTLW+gPnSCXOuyJT4uiRmzCJo6lHaioJ88h04fktbf61OSYQeO9gafWkZNshRMa9/eSl 0ImOQoptpWW/k8aD8/4EaWgAZNUjL7ooSRDHy7vkBtjGzqLxp+cKz6paZQsNqL5Khem5GftWcXbNw EgTpQiFfeOGaJAUiNVcklqkzxhb/U/2BWNaXERwgF4cX1Yev583OCBmcZaKH0xMT/lCb5UjMTCTUp snHr5CedN/FAthzUI+5fvM+/cf3nPSR75ZWYYOD2Zo7Yq0LKYHjVL/WvVDb0SNQfz9ENetNZjUyN6 eBXAL6tA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHny1-007w0y-Cn; Wed, 09 Feb 2022 14:29:09 +0000 Date: Wed, 9 Feb 2022 14:29:09 +0000 From: Matthew Wilcox To: Mauricio Faria de Oliveira Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 51/75] mm/rmap: Convert try_to_unmap() to take a folio Message-ID: References: <20220204195852.1751729-1-willy@infradead.org> <20220204195852.1751729-52-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=oj44LeKt; dmarc=none; spf=none (imf29.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 97CF1120007 X-Stat-Signature: ecgtmde9bigajjnjxw9rpsrno83u9ff8 X-HE-Tag: 1644416952-102228 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: On Wed, Feb 09, 2022 at 11:24:34AM -0300, Mauricio Faria de Oliveira wrote: > Hi Andrew and Matthew, > > On Fri, Feb 4, 2022 at 5:00 PM Matthew Wilcox (Oracle) > wrote: > > > > Change both callers and the worker function try_to_unmap_one(). > ... > > diff --git a/mm/rmap.c b/mm/rmap.c > ... > > @@ -1598,8 +1602,8 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, > > } > > > > /* MADV_FREE page check */ > > - if (!PageSwapBacked(page)) { > > - if (!PageDirty(page)) { > > + if (!folio_test_swapbacked(folio)) { > > + if (!folio_test_dirty(folio)) { > > /* Invalidate as we cleared the pte */ > > mmu_notifier_invalidate_range(mm, > > address, address + PAGE_SIZE); > > @@ -1608,11 +1612,11 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, > > } > > > > /* > > - * If the page was redirtied, it cannot be > > + * If the folio was redirtied, it cannot be > > * discarded. Remap the page to page table. > > */ > > set_pte_at(mm, address, pvmw.pte, pteval); > > - SetPageSwapBacked(page); > > + folio_set_swapbacked(folio); > > ret = false; > > page_vma_mapped_walk_done(&pvmw); > > break; > ... > > This conflicts with patch [1], currently in mmotm, and I'll send > another version anyway. > Should that patch be on top of these folio changes, or the other way around? Andrew and I need to resolve conflicts between this series and other patches in his tree. You don't need to worry about this. > The latter would help w/ the stable backports that don't have folios > yet, but I can > send backports there as well; not a problem. > > Thanks, > > [1] https://lkml.kernel.org/r/20220131230255.789059-1-mfo@canonical.com > [PATCH v3] mm: fix race between MADV_FREE reclaim and blkdev direct IO read > > -- > Mauricio Faria de Oliveira >