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 C538DC433EF for ; Wed, 9 Feb 2022 14:24:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 200536B0074; Wed, 9 Feb 2022 09:24:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 189EB6B0075; Wed, 9 Feb 2022 09:24:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02A516B0078; Wed, 9 Feb 2022 09:24:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id E4F9D6B0074 for ; Wed, 9 Feb 2022 09:24:51 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A2886181380C3 for ; Wed, 9 Feb 2022 14:24:51 +0000 (UTC) X-FDA: 79123462782.11.E6F2C7A Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by imf24.hostedemail.com (Postfix) with ESMTP id 1C050180006 for ; Wed, 9 Feb 2022 14:24:50 +0000 (UTC) Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 6F1783F211 for ; Wed, 9 Feb 2022 14:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1644416688; bh=/jtBgBZJr0M09mLpWCdwbeiLcjTbmSLlRU+RSibqKYU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=YGUUTIfwvcVRR0dDJuxbSq0xigWUAVG8eLwYP09agamrCAMJkRbWeLt0+PkkuWbTb ofFFZfwu4k0B0TEGKdoV7DNCtD1RDqPeVUUv4ePTWoEi+LVzO40u7uNAVC7260kLIZ H/idn+M4L5PvSviQg8oWqPPRCcTarAkv78/uRloeIlLiTwS3+yL1XcSJO6WP7+kUjR +ewBgMNhn8lTg9dXN8R/7gB7rkw3jyq+Is2sCPborKHVoCHQl2CFeMBY9DaVKhoVwV BDZOPpoYsL+ADYw3/nR6rWy38CNlvee8MtKVdxi2uksHOIF01xqE2L2xKhK5IWpdDh VW2d9Ctkwk9uw== Received: by mail-pj1-f71.google.com with SMTP id f2-20020a17090a4a8200b001b7dac53bd6so1800814pjh.4 for ; Wed, 09 Feb 2022 06:24:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/jtBgBZJr0M09mLpWCdwbeiLcjTbmSLlRU+RSibqKYU=; b=7WAfR0ASsTFUNvPgxGRaNV5iA6X6cu2HG7qnYr0Lcb1Zxg1emiV+91jlyer3wtyHHN dSX396iZWsxXmr4RVzZAPqENA6oey2AMJhodLPMvig2l0m0Hw+5R/N2FUUPi9MlnLQ+u hl/PwvxQOP5wHlGGBi2bOQGA9SZbx5Lm8rvPnMgGiJC3D2oyh3fjxxyN/X+z2+Ia51zw 2JvBWlzjVPFlZlebAct1WWo3Inx9/8zjFi5S4koquGF08ohzd0CQbfMP5HoQtJnQMTGT ra+masYqrrBhtCa0fX0r49JeKmfAYfyDrKPuZjSiv2Y08NKA3g7qxRNLtO7dp9bOPRP+ griQ== X-Gm-Message-State: AOAM530PQ4B4NFLKevURLNCDiEZTsQMdKd4+eimQg6f0mELThuAB39CU b4MsuIx2Ke08QPs8c7WJOW4Hbt8c/n21rASpQNq65NRH3qYraUwTyf2vVopSUSA7xJCjygv9GLU A3GA+y2ApLyaP4aO/LuJIo+sErAUuXQ01QN3olqFWr1RM X-Received: by 2002:a63:e054:: with SMTP id n20mr2021190pgj.560.1644416687083; Wed, 09 Feb 2022 06:24:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJygdhnjzmIdoKJK8oZqTsmTcv+ATV7Y5oUO+X7KpjGBaqvsfNxvAsbj2MI8knNQg5ah/9aHDhx1a+Xn2ei7EcI= X-Received: by 2002:a63:e054:: with SMTP id n20mr2021171pgj.560.1644416686737; Wed, 09 Feb 2022 06:24:46 -0800 (PST) MIME-Version: 1.0 References: <20220204195852.1751729-1-willy@infradead.org> <20220204195852.1751729-52-willy@infradead.org> In-Reply-To: <20220204195852.1751729-52-willy@infradead.org> From: Mauricio Faria de Oliveira Date: Wed, 9 Feb 2022 11:24:34 -0300 Message-ID: Subject: Re: [PATCH 51/75] mm/rmap: Convert try_to_unmap() to take a folio To: "Matthew Wilcox (Oracle)" , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=canonical.com header.s=20210705 header.b=YGUUTIfw; dmarc=pass (policy=none) header.from=canonical.com; spf=pass (imf24.hostedemail.com: domain of mauricio.oliveira@canonical.com designates 185.125.188.123 as permitted sender) smtp.mailfrom=mauricio.oliveira@canonical.com X-Rspam-User: X-Rspamd-Queue-Id: 1C050180006 X-Stat-Signature: 9rx6md3darmrhxxek5h8jrs7a74hticd X-Rspamd-Server: rspam07 X-HE-Tag: 1644416690-875618 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: 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? 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