Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12895217rwl; Tue, 3 Jan 2023 23:54:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXue7bNQkVRmnckHO/bZAZwwqiQTDJ6h6zltqdpHMNOhRpEjRaUcADMQ25zJvjm4iNpRBkaf X-Received: by 2002:a17:906:1e17:b0:84c:69f8:2ec2 with SMTP id g23-20020a1709061e1700b0084c69f82ec2mr23754594ejj.22.1672818875863; Tue, 03 Jan 2023 23:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672818875; cv=none; d=google.com; s=arc-20160816; b=ZETBFVVj/iCkhDNv0vATNeoD8YHBebGJHyjpIM1JsvSi2rXob4Kz0fklqcmRd3QdLZ cay7wsL5HTgHEuPnD4PMPK8u38SvZweTYI1xtZMjxN/iy6/TPiB1WMoDlO53UQgJJPld PqVjkcYp02+iaIbDstkk+52kmm6S4KfeiPaMF7D1satQpbgOXkhrPpUnyK4aLDKo5Atd xGE/dr+1JFJHobT3L4ax9nuZ57pwAWWPRoCBXG+1Fy84lW/Z4TGVWNY7Q+xScUFrQYcB fVAPkeLqSdpiMTaB0OVlpmQKLjuKmhPSIG8wQ6b6jGFApctbVIJY6t+GDYa7K5d7Vqgw YHPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AlUS4rFMq/APir3cFferSBeDNPK/ORyz2z3RjBS+Um4=; b=RLdMCJqU5PX6hywObIgc7rcCC9uJbtYiPTas99UnF0nL7gXTLCNtvWjR6pmfc4eDeJ WGO2xjTP20CEjnCYs4t8tntfL4Tkh3rgrL8ylyFrxfAWSmoA0YyrdXTU9/Jc/RSsCGw3 beXEX2yXyiRkEwCd3gDzphUgMblqFVSDzTICAAHF7TH9m0zqr67iqIYrSgITOGdBdc02 iSYewg3ZBhs+IWs/jipGAfDBn012an48giQWl2dLshoF0IsHDmj5D4yGgRAnLB3+pMJn +QBak0EHLD1FD0zFEjXG1Q0rQOQs1qgLLwwO7N0G78STm7mMmtYVjwK5fv3HUkNYfvK7 hIlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=kveBcYfo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg14-20020a170907970e00b007c1651709e3si31270508ejc.177.2023.01.03.23.54.22; Tue, 03 Jan 2023 23:54:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=kveBcYfo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233638AbjADHq3 (ORCPT + 59 others); Wed, 4 Jan 2023 02:46:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233436AbjADHq1 (ORCPT ); Wed, 4 Jan 2023 02:46:27 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 923DF101E4; Tue, 3 Jan 2023 23:46:24 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B3AAE38CE3; Wed, 4 Jan 2023 07:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1672818382; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AlUS4rFMq/APir3cFferSBeDNPK/ORyz2z3RjBS+Um4=; b=kveBcYfoIUBtm3F0Ar3Wt0T3ZwXS220F+aCXcfEt2trlB9EBAJ7qi0tZCSyVz9Jy394vRi bIuf4P+Yn+4Jd+aASe+doB5O3LBOQ7JR8s7BLXkkgluwrr98grKK2n4HmMHlAGF69yc/5M zuCrK+UYdOn2OzeZlK/la6hCRvOh7Cc= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 93117133D1; Wed, 4 Jan 2023 07:46:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LFCDIM4utWORBgAAMHmgww (envelope-from ); Wed, 04 Jan 2023 07:46:22 +0000 Date: Wed, 4 Jan 2023 08:46:21 +0100 From: Michal Hocko To: Mike Kravetz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, Christoph Hellwig , David Hildenbrand , Peter Xu , Nadav Amit , Matthew Wilcox , Vlastimil Babka , Rik van Riel , Will Deacon , Michael Ellerman , Palmer Dabbelt , Christian Borntraeger , Dave Hansen , Christian Brauner , Eric Dumazet , Andrew Morton Subject: Re: [PATCH] mm: remove zap_page_range and create zap_vma_pages Message-ID: References: <20230104002732.232573-1-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230104002732.232573-1-mike.kravetz@oracle.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 03-01-23 16:27:32, Mike Kravetz wrote: > zap_page_range was originally designed to unmap pages within an address > range that could span multiple vmas. While working on [1], it was > discovered that all callers of zap_page_range pass a range entirely within > a single vma. In addition, the mmu notification call within zap_page > range does not correctly handle ranges that span multiple vmas. When > crossing a vma boundary, a new mmu_notifier_range_init/end call pair > with the new vma should be made. > > Instead of fixing zap_page_range, do the following: > - Create a new routine zap_vma_pages() that will remove all pages within > the passed vma. Most users of zap_page_range pass the entire vma and > can use this new routine. > - For callers of zap_page_range not passing the entire vma, instead call > zap_page_range_single(). > - Remove zap_page_range. > > [1] https://lore.kernel.org/linux-mm/20221114235507.294320-2-mike.kravetz@oracle.com/ > Suggested-by: Peter Xu > Signed-off-by: Mike Kravetz This looks even better than the previous version. Acked-by: Michal Hocko minor nit [...] > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > index ad608ef2a243..ffa36cfe5884 100644 > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -2713,7 +2713,7 @@ void folio_account_cleaned(struct folio *folio, struct bdi_writeback *wb) > * > * The caller must hold lock_page_memcg(). Most callers have the folio > * locked. A few have the folio blocked from truncation through other > - * means (eg zap_page_range() has it mapped and is holding the page table > + * means (eg zap_vma_pages() has it mapped and is holding the page table > * lock). This can also be called from mark_buffer_dirty(), which I > * cannot prove is always protected against truncate. strictly speaking this should be unmap_page_range -- Michal Hocko SUSE Labs