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 CD07DC433EF for ; Tue, 8 Feb 2022 13:09:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15AAC6B0074; Tue, 8 Feb 2022 08:09:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 10A2B6B0075; Tue, 8 Feb 2022 08:09:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3A636B0078; Tue, 8 Feb 2022 08:09:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0046.hostedemail.com [216.40.44.46]) by kanga.kvack.org (Postfix) with ESMTP id E5C966B0074 for ; Tue, 8 Feb 2022 08:09:31 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A47BE181951E7 for ; Tue, 8 Feb 2022 13:09:31 +0000 (UTC) X-FDA: 79119644142.10.0740AB0 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by imf16.hostedemail.com (Postfix) with ESMTP id 43090180004 for ; Tue, 8 Feb 2022 13:09:31 +0000 (UTC) Received: by mail-qv1-f52.google.com with SMTP id g3so9322019qvb.8 for ; Tue, 08 Feb 2022 05:09:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:from:to:cc:subject:references:mime-version :content-disposition:in-reply-to; bh=/s8FiFoNXLlWJsEmo8dsRXHngSoVZR77SSlKzOXt7DI=; b=QohgGiltFrcaDVrGMMj2PZ8boBvyEj0cqCLWL7vcz5XGkiAJ0tuv/Z5UkNsIOyiwMG aaKAT8a83xmJsTJ2pcdAOOM6ZXTv9b8fqJxtB4wP0yuKrBJCSBsfJJkhRFQuwm/1ciE5 QqqanCkfFbGJbk264uR9ysMViQXC5fqWfzFvhaxCkMikCe82TMerVEOOxDK0L3kGNATY 1f5BxY7lD44t7ZoYNXCNTyY+eVSjDyXfRcrzt7G27POwqZYhmCu2pveGJxzCkv3Y6x+C QTfNUvr8z8I9gPr2hqMHsUTz/VwjPKB51GdPoRFXEXJQ29/J3UxIYjfQh8R66g9h/ZU5 oAcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:from:to:cc:subject:references :mime-version:content-disposition:in-reply-to; bh=/s8FiFoNXLlWJsEmo8dsRXHngSoVZR77SSlKzOXt7DI=; b=l9CS5YpN99rRafV7Uo84Sp/JILlKZKgv7LldYgENydvsOe/V7uB/+erpCMqaueKKD0 oOtY11vI9SfCBLfFSAsyhM8p0hYfdUp7YvR68xsXG83lwqohRrNQKdqdL9PNvZYxGdCD fZ4OXs7WX7lpdg0uCCrRiZeFQ7BOB/Q0yv6OBCiQplRWWHj3PiisKW65B9nlIwxo3LSo Qd/1UH+1PHnyMctNORYIIfjQMgZ/qIXAnSF4XhJ3HgfD2OZmsvDc9cJegZbOLU5Zqtmt iVFTjmCTlDg2z3FWNHz7L7OcWcoFuZys7iwl7CHld4wKzEp0vmncgrgf2p5lLKYT9dzE /Tqw== X-Gm-Message-State: AOAM531oJCXMOgKfUu0bpSOCe+/ANfheKbkhZPwPUHsS/heolNZv/lg9 e9DsJ+6fc41nzbHLGEIca1Q= X-Google-Smtp-Source: ABdhPJxub5M8X2BfoYXJ/OcdvPF/ttHYF+U/7kF+/8iFMr+Mhgsh7qFlN9/MWHAE93sNGZBtdzD3yg== X-Received: by 2002:a05:6214:b66:: with SMTP id ey6mr2827201qvb.131.1644325770607; Tue, 08 Feb 2022 05:09:30 -0800 (PST) Received: from localhost ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id q12sm7657455qtx.51.2022.02.08.05.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 05:09:29 -0800 (PST) Message-ID: <62026b89.1c69fb81.b9102.7042@mx.google.com> X-Google-Original-Message-ID: <20220208130926.GA1537772@cgel.zte@gmail.com> Date: Tue, 8 Feb 2022 13:09:26 +0000 From: CGEL To: Hugh Dickins 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 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> <72532675-d898-9f30-1ba4-318fbd61786@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <72532675-d898-9f30-1ba4-318fbd61786@google.com> X-Stat-Signature: jzqfopjkfcpffzs68wfbe9d3z1t4717p X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=QohgGilt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.219.52 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 43090180004 X-HE-Tag: 1644325771-558026 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000385, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 07, 2022 at 07:22:22PM -0800, Hugh Dickins wrote: > 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()? > I think it's two questions, first why PSI didn't treat wp_page_copy() as memstall, second why should PSI treat ksm_might_need_to_copy() as memstall. The first question is unrelated with this patch. I think the reason is PSI focous on memory contending(see Documentation/accounting/psi.rst), and wp_page_copy() is not caused by memory contending. Actually wp_page_copy() will still be called if memory is not contending. For the second question, ksm_might_need_to_copy() is called only becaused of swapping, and swap is caused by memory contending, so PSI better treat it as memstall. Thanks. > Hugh