Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp953108rwl; Wed, 5 Apr 2023 09:48:01 -0700 (PDT) X-Google-Smtp-Source: AKy350Z+k3B/6CThFQQA3Rx7F+EaswGjNc99jdKkyxPIQv1cWy1W08SxQUv04bf6A/udK8cW3toY X-Received: by 2002:a17:906:5a93:b0:933:3814:e0f4 with SMTP id l19-20020a1709065a9300b009333814e0f4mr4159460ejq.16.1680713280745; Wed, 05 Apr 2023 09:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680713280; cv=none; d=google.com; s=arc-20160816; b=KIWxRikzxfiUxk1nFE0IdAeYlRJEhpQNFTFJuuR8URaUIWlUK4XyKrFn0+ay1lkCSB zoZ0mUWPD5//yrW1Y8ZGvl4syCsrTbdq5cEyVo4Jlf0mdGQ5se9+S/5Qf5KyLqoEpWRU MereyNmS1Rh5v7fP3DjXbASYDWynx6ia2uNi0TJNkQOsgIY48MVK9EvYtcMrUV2PKybJ dXrTXcI/N1uNeMjKLZPR6L8Kw3vjza1gZ+PZbP8qK3d7Ap1qh0CXJAQ4X50lRe32ybc4 YkrxPMq5LNBFN5u3+55NhqmwGBq4FxM+jHmgC0iDZNwTVYaPx8Ub0yHmReHQcStPmcti Citw== 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=ic9QOvyB41Y2i/Y5O+2Wte/XHLF8XILIloIzMxQmtv4=; b=ot1v4g6qkQHq9Z/KzscBen2UfLxEEoR5DZ72fdba0I8ibHc3RBJTRGha6IG3Va1Te/ qjMsBzshnX4CVZ6qR86+1jyzECI0lJqlCFRjRB6pY5f6V75RqJ/nmXojHqZxMcdB54wU Dbb7hVvdQVX2T9Q0ZMq/uSF9Gsr1krNCK3ie4mrEWbgAb+OokuzP6JD6haJp5DuXrl/d YwHLOh1YUVxBONRAwIhQIPNW8PHlj38SSMbOmnXh7+ztaCpS5tNEbOSbKVArCybeQ0IV SSN4Ou1j0lgFqL/HyaoOI4tIao+1u9stlwiK4BmeUdLCPp9RVFmofp0nmtDaGdLyXePB +Kuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qBB2UMFJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a1709062c4400b009325610fddcsi6124056ejh.501.2023.04.05.09.47.33; Wed, 05 Apr 2023 09:48:00 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=qBB2UMFJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232690AbjDEQp3 (ORCPT + 99 others); Wed, 5 Apr 2023 12:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbjDEQp2 (ORCPT ); Wed, 5 Apr 2023 12:45:28 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AB8410FA for ; Wed, 5 Apr 2023 09:45:27 -0700 (PDT) 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=ic9QOvyB41Y2i/Y5O+2Wte/XHLF8XILIloIzMxQmtv4=; b=qBB2UMFJ0uk6rP4OhE6b6msGJE yBtaGNpZWXKqSIUgTr92VD7DatKS6EceYmT1+NI7p+PbJKwDa0K6kA9wZh3cQ8/4QMvUZYADmvlhC 3BuZRAPnvpTXNS7+nyXx0KOylpcOIfNuoYdfeSoKxWARTZgBBYWwFh4Hm4Foyt5x8G6czYtUvjoyv eEOBZ2GMyZNnvFnYd/Dsc2MGPUJFyY4N4PbM+elXGAHCxKRxotOA/ZAupdUqbGRI5ACMH6F9LxICS /LZtsO3ZN1QKd+aSfymlFEDyg4GPCX6p/udQqEcQXQrF+8EQAOPzcat2cgHCutrkh4SUYTaFSHkpN s96HGpcQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pk6G0-00GYSX-02; Wed, 05 Apr 2023 16:45:12 +0000 Date: Wed, 5 Apr 2023 17:45:11 +0100 From: Matthew Wilcox To: Qi Zheng Cc: akpm@linux-foundation.org, lstoakes@gmail.com, mgorman@suse.de, vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] mm: swap: fix performance regression on sparsetruncate-tiny Message-ID: References: <20230405161854.6931-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230405161854.6931-1-zhengqi.arch@bytedance.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Thu, Apr 06, 2023 at 12:18:53AM +0800, Qi Zheng wrote: > The ->percpu_pvec_drained was originally introduced by > commit d9ed0d08b6c6 ("mm: only drain per-cpu pagevecs once per > pagevec usage") to drain per-cpu pagevecs only once per pagevec > usage. But after converting the swap code to be more folio-based, > the commit c2bc16817aa0 ("mm/swap: add folio_batch_move_lru()") > breaks this logic, which would cause ->percpu_pvec_drained to be > reset to false, that means per-cpu pagevecs will be drained > multiple times per pagevec usage. My mistake. I didn't reaise that we'd need a folio_batch_reinit(), and indeed we didn't have one until 811561288397 (January 2023). I thought this usage of percpu_pvec_drained was going to be fine with being set to false each time. Thanks for showing I was wrong. > Fixes: c2bc16817aa0 ("mm/swap: add folio_batch_move_lru()") > Signed-off-by: Qi Zheng Reviewed-by: Matthew Wilcox (Oracle)