Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp834184pxb; Tue, 8 Feb 2022 03:38:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZpvYQEAj37S5GbMLY+34R+2y0W42VzgU68cAZq4vVkYtrEJvL/X7Hz0rsswv17d6/gxX3 X-Received: by 2002:a63:371b:: with SMTP id e27mr3152675pga.618.1644320336534; Tue, 08 Feb 2022 03:38:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644320336; cv=none; d=google.com; s=arc-20160816; b=lT9cUdCw47v5JcVgNhNZQS7j8LxPVduRRBN9tT/spK/9wRcm/cucdJ6zmAdZda0Yly lncpshyG2ZSKs90x2PvI6dht359MFmJluVZCFDI9rQIXXXTZU1L37OvficNPcvaN7g1C +L3WsY3VyjtmmdbzY7igdGxlmOhCrC/pQrQz3hR42fZAJeMogf9fHqdrurE4AxZ3ij3e Quyo4+nD43s1iZr33gCCErJfK1l/qCbDzBPjhnxIe/a31jnNSBMxj5w55/jqBPbSUaOB rsNZmqBYSwNLNz3339Tzor7fw8p7EBFibBYwzWWwQrZnoVebEgjvbaQ9JOgmOdZGfywb QTnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=90XsEdNXJrY04sKVLTFX0hH6LSLsZT/XD+WqONrkToE=; b=BEzSWE7l8iHaMV8bCYh5lJ6nE74L2VGll7C9Ru00iPZPjnxMoGaNQSOAXs4xAH5aBU UV3L1/mN/kVWrRuPtwU3j49/A3FAB/0JrSpMvQ4ImJuv63+UZJ0UII8yMvKOEMSOqpix DOhsJxrsqHzNesIjfee5CoAY/GB9jIgF4PZQLsh332XJAQjFkkhBv25qDJkHndaSjSiK W7Fz/yGK9zn3ysfbT1iQmSJveM5wrI0jetuQkSpdaoCeevVn1JQsqC9McyXehoixlrHa pN4Ns3aiCKFCrHrUr55XiOwAEBUbrX4B/v74N0cgyawJRvBLcFgM1bPwXxJNhPhMITh+ Ngjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=A3MJ4wbI; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g4si12039951pgg.81.2022.02.08.03.38.43; Tue, 08 Feb 2022 03:38:56 -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=@google.com header.s=20210112 header.b=A3MJ4wbI; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346366AbiBHDWm (ORCPT + 99 others); Mon, 7 Feb 2022 22:22:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231912AbiBHDWk (ORCPT ); Mon, 7 Feb 2022 22:22:40 -0500 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29209C043188 for ; Mon, 7 Feb 2022 19:22:39 -0800 (PST) Received: by mail-qv1-xf30.google.com with SMTP id fh9so5214533qvb.1 for ; Mon, 07 Feb 2022 19:22:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=90XsEdNXJrY04sKVLTFX0hH6LSLsZT/XD+WqONrkToE=; b=A3MJ4wbIsuKoXv2XlF+FIWZDf6FKTHnTRwv/el2HCZDOJL8MM0JUDUMXydMJ9qi4ax QKPE9ODBrOzNvMKOWrFY6PwMorAsBCmCHACP+tDJTlBOc/+pgLzYxfcUNoWhEm7k+B3+ pAIaToCVRmNn1ADS//ppPQRdQfhrB+8z0oE33Nzpw8QrulQLvfOcrt0unVcj4VvIysdL AxtrdhBJIYEhtkBeduKmSHdfiHzTwW8A3f2KwJUcAxeC4/UEqJ2Ve7BINyhwvrNwSmRW qIcigu49r9AdsLQJXqyxIB9ClQ75uP1XfhIShlIJOOJ+KyzPabViwipr5JZGH9aEZrDu KpKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=90XsEdNXJrY04sKVLTFX0hH6LSLsZT/XD+WqONrkToE=; b=yroGDjahtbB/jX+jfnekVANS50iqbzCP/z26qcM/HJYhghY72xYm4osrHalsgYdhRC aU9vl9ALigo8D7fgmIxnWuchi61wdhkAB57Z4/mG3EAJNV3IrxWKpMgAYeFHh2WWJlHY VkAGbFF4ulLE54MyRil2CBwkJKx7liygWISXn0vyNci2dZ/lIi+IwOkB3zslITcuBJZw VuOSVyHoTDh1UTZjD86vqKyAjI0br1l7tNZ9d+W6yIZK8FhzugzvqBeAIGQSSmIwDJHp 7lJD9FXWPtND6d99tgaW9NQa7Sptmm4pbUciiNW0J6jbE5gSm+OYrB6SR06YOYlEyuEx XG5w== X-Gm-Message-State: AOAM533PqfJs85ZrFKSAzC8dSLiWDmeDq8SH3a+E+em9Yu6qMBOAA5sL CcwASSGreqaMNAxbTFvvOhuB7Q== X-Received: by 2002:a05:6214:5081:: with SMTP id kk1mr1932846qvb.112.1644290558185; Mon, 07 Feb 2022 19:22:38 -0800 (PST) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id u35sm6948625qtc.26.2022.02.07.19.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 19:22:35 -0800 (PST) Date: Mon, 7 Feb 2022 19:22:22 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: CGEL cc: Johannes Weiner , akpm@linux-foundation.org, sfr@canb.auug.org.au, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yang Yang Subject: Re: [PATCH] psi: Treat ksm swapping in copy as memstall In-Reply-To: <61f35591.1c69fb81.48dad.3244@mx.google.com> Message-ID: <72532675-d898-9f30-1ba4-318fbd61786@google.com> References: <20220116152150.859520-1-yang.yang29@zte.com.cn> <61e7ac25.1c69fb81.e8938.bc67@mx.google.com> <61ea820f.1c69fb81.e79d5.09c9@mx.google.com> <61f35591.1c69fb81.48dad.3244@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Fri, 28 Jan 2022, CGEL wrote: > On Thu, Jan 27, 2022 at 08:29:08PM -0500, Johannes Weiner wrote: > > On Fri, Jan 21, 2022 at 09:51:08AM +0000, CGEL wrote: > > > Wed, Jan 19, 2022 at 07:58:23AM -0500, Johannes Weiner wrote: > > > > On Wed, Jan 19, 2022 at 06:13:54AM +0000, CGEL wrote: > > > > > I did a test, when we use zram, it takes longer time for ksm copying than > > > > > swap_readpage(). Ksm copying average takes 147263ns, swap_readpage() > > > > > average takes 55639ns. So I think this patch is reasonable. > > > > > > > > Ok, that sounds reasonable to me as well. Please add the > > > > PageWorkingset() check and resubmit the patch. Thanks! > > > I am a litte confused about adding PageWorkingset(), since I > > > think ksm_might_need_to_copy() memstall is like swap_readpage() > > > memstall and swap_readpage() doesn't add PageWorkingset(). > > > > That's actually a bug! It should do that. > I recently found that too. Please CC to me your new patch, thanks! > And I will send V2 of this patch "psi: Treat ksm swapping in copy > as memstall" with PageWorkingset(). I'm entirely PSI-ignorant, and reluctant to disagree with Johannes, but I don't see how your patch to ksm_might_need_to_copy() could be correct - maybe the "swapping" in your subject is confusing. There is no PSI enter and exit around the page allocation and copying in wp_page_copy(), so why in the analogous ksm_might_need_to_copy()? Hugh