Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp431780pxb; Wed, 8 Sep 2021 04:41:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKTMDyCEDv4EVrZhJTWGiSrXHn98PLtqWk4cI3ujh0EjArkIpxDrZQA0/A09E6dSDE6u/Z X-Received: by 2002:a05:6402:14d6:: with SMTP id f22mr3414614edx.274.1631101291676; Wed, 08 Sep 2021 04:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631101291; cv=none; d=google.com; s=arc-20160816; b=FDiGt/+0kDD8+PLgzMzZUE2CzTu4iHB2RFHZ2VFFdx2E0q4ujUUWmWPl5UEqMrZOew sMPT+JmTH96rS5G697tinhHRrMhaXU2VPs/sAXMvUmN2/u9BjjEvdE8QRdi5LIzta7E1 qwwjnem8GFwfaA6fenwuZcG04M8VEmm+FBd6BlhGKw/C1ykulO744YX+3cgoY6hv0yQk euJAPvX8Qfs06jN8Ebch4ifF8pcL8pJ+zucAKwJddTuK4o8tzLSQlBeon6IdtN+LQ5oQ ViUkZ2IUse8sXbSPe2frQSaYEnuUm0vLxppHWLwHI5dX7i60utT9iYXu/hmPjb1Xoqw4 pAvA== 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=CxVbl1NeHOmwGOjTCkO4fNrdlLNXumgR3g3uKY0Phu8=; b=zI+0QPLHYpT766KWNlEn+8xwhq5Iw755Y4/2hJbGMepFzLJhJTgwv780wS/VYPJrTx suZm2/u9E+mCy65nIH0HBAET3agy9v6VyKegWFAOrvD8DegY+4IFWM2L0gRoOYgjLQ7N S1xG5o9/sE2hFg5lvIcB32VlYmkla+UzKNvY+/bakElLcT36sXYTqsojP9w/cTY7I2ze x2asZTOk8wlveZdFCZ14zVyBQK8P1krofjagz+JBuuO52Xbpuc26Hi2bDABHEiRToOo1 fYe/WKMfae9gQSWMSpxjzodv7hwwrA2+19EGzYbCKLnZ6rkFXCZ1olG0m9kYsEleHpay xrwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=PhLB7xEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si1938747ejk.321.2021.09.08.04.41.06; Wed, 08 Sep 2021 04:41:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=PhLB7xEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349287AbhIHLhw (ORCPT + 99 others); Wed, 8 Sep 2021 07:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349245AbhIHLhu (ORCPT ); Wed, 8 Sep 2021 07:37:50 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0863C061575 for ; Wed, 8 Sep 2021 04:36:42 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id u21so1490659qtw.8 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=k1B+lp9lvJhTzSedJowGL2kszfOqbrEFhyGfGg3dh0dJyBSUj2FHWHk3CBo9L8sMAO CdCfN1vbuZRnhApl5Qie4N5WqK1QWUTsxhvnZ8f+HmcYG33OV502nWgbg91+1vI5GvnS SKeWtkVUbJXCD21xq4tlFVapqqdYF+d+3ZVlV3I3H+0zWZB9PjUfEHahSrC9VKDBjA5z DhUaGiIL34UGksGmkuh4mVYWkaIZuZL0s49yjI2IECUARWfPtrtmnDFp21s9N/geGNRI gkbA5r+gZDAr6HKE26LGYYkLAVmB/6fJ5KZaP5cUqInngvTsBDeiN09j1+GqnCcpmQPV wnNQ== X-Gm-Message-State: AOAM531f0F6lxzHwwS9ZZ2tWqG9kU+rB88Gla/rvZQj98JWl7ldqO5+o xno8q6rrUeBZ4fN3/HL1djjqSQ== 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?