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 6A13AC433F5 for ; Fri, 28 Jan 2022 02:31:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA1A86B0075; Thu, 27 Jan 2022 21:31:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D50F26B007D; Thu, 27 Jan 2022 21:31:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF17A6B007E; Thu, 27 Jan 2022 21:31:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay038.a.hostedemail.com [64.99.140.38]) by kanga.kvack.org (Postfix) with ESMTP id AD9B46B007D for ; Thu, 27 Jan 2022 21:31:47 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6CAD520455 for ; Fri, 28 Jan 2022 02:31:47 +0000 (UTC) X-FDA: 79078120254.03.27FAA39 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by imf27.hostedemail.com (Postfix) with ESMTP id D938840013 for ; Fri, 28 Jan 2022 02:31:46 +0000 (UTC) Received: by mail-qk1-f173.google.com with SMTP id 71so4417578qkf.4 for ; Thu, 27 Jan 2022 18:31:46 -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=5u2jhzSbci02DpL8YYcbGQRLZiKg87QxYq8u7qHJ9q4=; b=k+CMzbUW2NpYbVjuhjmSVirvpjKYpwBBGYvOOD7fqs6OwOWdT3uEVzuqRIJDTfW9EU BZh4Yy8lVJvdwaI0v7Xwjc9U7TC0NP/48na4FHtTWVK2jKRlpWMvY3IvXKZqeKAql4A0 6S0XrtmGnRSSap25iyVYj8JdhQxE162urXriyAINPudsfO7Xa7eY/7vuvXLeQNlPR1ru WpOi1gAwKCdFf4gN0i2tHLMyJH6+Hd9r16yB6W6L31wjxQEaZ+RKs3PWr75c2XqtUNmQ ffq4DOhK0XFGWRCEQwe4QmhR1UaHVW3yIJW89At/1M0kAEmT5Uc6Jcmbe43Ljn0suf6d eGqw== 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=5u2jhzSbci02DpL8YYcbGQRLZiKg87QxYq8u7qHJ9q4=; b=7YgatZ5ImKDfBHB4FUAwq4sMYoL/2jP+SfsviD2NXLnW4T06JON+zygUl+9/6FIsU/ 6Ucx7lJc1zPmFbmajfjhZP6tVRFs6fyfbbyeNF7Pozg35gKVKZ8xpowltnVNzQtZAImD oThyCV0jF6OGSL8q0q7crJw9Ge8eLwM7XHeUYUda+MykfqX9U0uHYomaUPljhtmjDZFK 7bszACktVvlBqrMrmWMezwnP9CgOsB+xTFc7eGxmL6ZP8MOmqJ+hkKRFkafFJV/DRlUH 883aIUgE3MEpOMVOh1L94olxmpDl9tCLxAq18IX7+N6nugxOH/reuyKHcjDV0GjUCSOc tZKw== X-Gm-Message-State: AOAM531BK1QUlVftvil+vxNPe8FymYGvgbpUxq3nPwo76widFWO/K/Ua qi0S5SE3mUOwLRud/wOOQKA= X-Google-Smtp-Source: ABdhPJyO95xPseqHxFw59OvWUfHS8aZwDZkQFNWL5W7osk2CvOn1CX1Y/27eooB14xz418xa9vcZzg== X-Received: by 2002:a37:660a:: with SMTP id a10mr4664131qkc.506.1643337106234; Thu, 27 Jan 2022 18:31:46 -0800 (PST) Received: from localhost ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id i4sm641272qkn.13.2022.01.27.18.31.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:31:45 -0800 (PST) Message-ID: <61f35591.1c69fb81.48dad.3244@mx.google.com> X-Google-Original-Message-ID: <20220128023142.GA1205335@cgel.zte@gmail.com> Date: Fri, 28 Jan 2022 02:31:42 +0000 From: CGEL To: Johannes Weiner Cc: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: epkc97d98jgyyuu83qcz8rjynpfz8u5q X-Rspam-User: nil Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=k+CMzbUW; spf=pass (imf27.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.222.173 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: D938840013 X-HE-Tag: 1643337106-613358 X-Bogosity: Ham, tests=bogofilter, spamicity=0.004457, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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(). > That psi_memstall_enter() in swap_readpage() was added by commit > 937790699be9c8100e5358625e7dfa8b32bd33f2. It's for catching the > scenarios that don't go through submit_bio(). When you look at > submit_bio(), it counts stalls only if we have workingset pages: > > /* > * If we're reading data that is part of the userspace workingset, count > * submission time as memory stall. When the device is congested, or > * the submitting cgroup IO-throttled, submission can be a significant > * part of overall IO time. > */ > if (unlikely(bio_op(bio) == REQ_OP_READ && > bio_flagged(bio, BIO_WORKINGSET))) { > unsigned long pflags; > > psi_memstall_enter(&pflags); > submit_bio_noacct(bio); > psi_memstall_leave(&pflags); > return; > } > > I hope that clarifies it. I'll send a patch to fix up swap_readpage(). > > Thanks