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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C604DC4332F for ; Wed, 8 Sep 2021 11:36:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5C19161132 for ; Wed, 8 Sep 2021 11:36:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5C19161132 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 99A596B006C; Wed, 8 Sep 2021 07:36:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 949BF900003; Wed, 8 Sep 2021 07:36:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81167900002; Wed, 8 Sep 2021 07:36:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 722D56B006C for ; Wed, 8 Sep 2021 07:36:43 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1653E8249980 for ; Wed, 8 Sep 2021 11:36:43 +0000 (UTC) X-FDA: 78564203886.13.3301107 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by imf15.hostedemail.com (Postfix) with ESMTP id B4A17D000097 for ; Wed, 8 Sep 2021 11:36:42 +0000 (UTC) Received: by mail-qt1-f178.google.com with SMTP id g11so1502514qtk.5 for ; Wed, 08 Sep 2021 04:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CxVbl1NeHOmwGOjTCkO4fNrdlLNXumgR3g3uKY0Phu8=; b=PhLB7xEzyYMO4ug5NLmHBrjiQJfJIgt9af2XwwRxN/CbrlVzAQ9nP6MV3dGJyMZ+iN dEr2fhakSYLAu74YiYFswbacvSx9JGiBednwW8rGK2ZF8EZHzQIvdbmZnl21+5TTidZm 4aXwoOgKm29Kxx68Dm+oNdBrk9tTGAz0iLYMmtsaAKvmJq7SZtXOiWiinVdlpjn4t7lb tGyHLuDkztQO24R0eDXScwfEofTSq5YNHeFUByAvO40rKNE8HKMnyhNeKi7KBfl/99aS BepBdG4nz6jTn29+b/7dYK7JSZjCOoF3afl2FvMHRyiRO7CDQgebD7ue5zplY5oqMn7I ZbOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CxVbl1NeHOmwGOjTCkO4fNrdlLNXumgR3g3uKY0Phu8=; b=qIMhdycIryW8Xq2Gpete+TxTSYMfJzzEOUpic69W/FtjG7o3ybGMyu4YLBAawZ5TfA v4z/irlsTn2INr/L2AfUpIKJt5gus6x0PxR8YX/CvwSq8VyEXlkB4NRAEFX77YhayKcX PAJFDym1jEdGTht94HNI97yj/kpxaZJnO+g2cLTtxhY5cvkCgnqeOJfZ/WDQ6nS9oQhw tlKopmh8ei42hS9fB+0Jkc2isSV8H14TQFflX7MwQtncCz3S2XLepARWexEOzEPaHHpf 94MDMajGBNnZxMKGpQ80wWkplmehmUULbPuwee3MBPpZcLuy7cpJsS/OeqRadBa4hhml 6sGg== X-Gm-Message-State: AOAM5323bXB0TsjtbCLcNbCqmL6R6K4mQIc8Hm/J7Zqh/qB8E7VYGrnh apfLBGT9SyXuhv/UWwXaCo/6xL4b2xg5pw== X-Google-Smtp-Source: ABdhPJzgPm55269QZnGtldqlzox3IAdOxvhJ61R1CAlHX5+DY+sPztfcEnuKG2TM1uli3z0c5Pl00w== X-Received: by 2002:ac8:4716:: with SMTP id f22mr3120727qtp.250.1631101001992; Wed, 08 Sep 2021 04:36:41 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:190a]) by smtp.gmail.com with ESMTPSA id x83sm1437263qkb.118.2021.09.08.04.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 04:36:41 -0700 (PDT) Date: Wed, 8 Sep 2021 07:36:40 -0400 From: Johannes Weiner To: Zhaoyang Huang Cc: Vlastimil Babka , Andrew Morton , Minchan Kim , Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML Subject: Re: [PATCH] mm : bail out from psi memstall after submit_bio in swap_readpage Message-ID: References: <1631015968-9779-1-git-send-email-huangzhaoyang@gmail.com> <79c08d1d-eef5-bc15-8186-7e3367b4ebe7@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=PhLB7xEz; spf=pass (imf15.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.178 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Stat-Signature: mprq7czxhnii3ex9tseeks74mihwdtix X-Rspamd-Queue-Id: B4A17D000097 X-Rspamd-Server: rspam04 X-HE-Tag: 1631101002-694788 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Sep 08, 2021 at 11:35:40AM +0800, Zhaoyang Huang wrote: > On Tue, Sep 7, 2021 at 9:24 PM Johannes Weiner wrote: > > > > On Tue, Sep 07, 2021 at 08:15:30PM +0800, Zhaoyang Huang wrote: > > > On Tue, Sep 7, 2021 at 8:03 PM Vlastimil Babka wrote: > > > > > > > > On 9/7/21 13:59, Huangzhaoyang wrote: > > > > > From: Zhaoyang Huang > > > > > > > > > > It doesn't make sense to count IO time into psi memstall. Bail out after > > > > > bio submitted. > > > > > > > > Isn't that the point if psi, to observe real stalls, which include IO? > > > > Yes, correct. > > > > > IO stalls could be observed within blk_io_schedule. The time cost of > > > the data from block device to RAM is counted here. > > > > Yes, that is on purpose. The time a thread waits for swap read IO is > > time in which the thread is not productive due to a lack of memory. > > > > For async-submitted IO, this happens in lock_page() called from > > do_swap_page(). If the submitting thread directly waits after the > > submit_bio(), then that should be accounted too. > IMO, memstall counting should be terminated by bio submitted. blk > driver fetching request and the operation on the real device shouldn't > be counted in. It especially doesn't make sense in a virtualization > system like XEN etc, where the blk driver is implemented via > backend-frontend way that introduce memory irrelevant latency Yes but the entire IO operation and all the associated latency only happens due to a shortage of memory in the first place. The thread is incurring these delays due to a lack of memory. What is a memstall if not the latencies and wait times incurred in the process of reloading pages that were evicted prematurely?