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 517B4C433EF for ; Wed, 1 Jun 2022 07:53:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 98FC06B0080; Wed, 1 Jun 2022 03:53:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 93F2D6B0081; Wed, 1 Jun 2022 03:53:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8054C6B0082; Wed, 1 Jun 2022 03:53:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6F46F6B0080 for ; Wed, 1 Jun 2022 03:53:12 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 36EA160956 for ; Wed, 1 Jun 2022 07:53:12 +0000 (UTC) X-FDA: 79528901424.14.3F6203E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 28A1D1C004F for ; Wed, 1 Jun 2022 07:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654069990; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WfTQV2dw8hYxGglp3MNiBHOFQe8P3zuj5Ixn98HI0Bs=; b=ghJYqy5xw8yLiUPLTWkFZZCzyVF8pO61wWZt/TsalDftxLHEz3skt7WQoRVnfbWoqhVVaq pQDaR2HRFBSUFeqk22GKqckzNL2cw/oiUISL5i0CpO9pqUZxOuHK06g+lEy2+8DJerFzad ynyFkVzz69VCuAxtlTlFjXWKNNZsCSA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588-G9cGbD-sOmKmdxPX1s7kfw-1; Wed, 01 Jun 2022 03:53:09 -0400 X-MC-Unique: G9cGbD-sOmKmdxPX1s7kfw-1 Received: by mail-wm1-f69.google.com with SMTP id c187-20020a1c35c4000000b003970013833aso532789wma.1 for ; Wed, 01 Jun 2022 00:53:09 -0700 (PDT) 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:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=WfTQV2dw8hYxGglp3MNiBHOFQe8P3zuj5Ixn98HI0Bs=; b=zL9G4Y8tm61YzBUPGH7U4zjNDxw+IoS7p2R4bnPs587AErfvylK+tXDvAokf3h7A5+ KAC+29ywFYTYyTYJ7Zpz6zmaJwA6eh+mD80tsl+68Yd4aPqvEE/1LhSAV4ZZDWtdw8kP EgX8MXr2NLdsYQ0Yduc+cyGqZ4VOcwlusMpJ9YOvhnGrAqDHxUQTOwGWGugNp7blEXbx c8gLl39nSMpV754hg3qsr/ZJWKIOUKTihHjtwRffR0LH0hXxTxPWwuQya1m3DMz6eolt PlzZfV7h9l+bqUl4a+7MlDom7Cx0DKHYxQFmMIgax5mWvN8PSr8KqWmgbcgPiAwTRiCa JQ6Q== X-Gm-Message-State: AOAM5337V6d/jkegt4GYLNvxel+ZVu7hDJo2D/NRb4ovP0gIAjTlMcWz V3qNu/QL2fBdA02z5BnLwh/37l1flOYW5lF8LpkmjXLteDn6yxNb7AeXa787Ib1oMu9W32an5P3 lBNBidXjfD1o= X-Received: by 2002:a05:600c:3b20:b0:397:6311:c0c7 with SMTP id m32-20020a05600c3b2000b003976311c0c7mr26773655wms.69.1654069988552; Wed, 01 Jun 2022 00:53:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIP/IShrFh9WxWIxXWGHraxlb9iB2vLncW/DvU4dVpsiNbC+hBWi5Buj/lRSq8+rr+RmMzCA== X-Received: by 2002:a05:600c:3b20:b0:397:6311:c0c7 with SMTP id m32-20020a05600c3b2000b003976311c0c7mr26773635wms.69.1654069988286; Wed, 01 Jun 2022 00:53:08 -0700 (PDT) Received: from ?IPV6:2003:cb:c705:2600:951d:63df:c091:3b45? (p200300cbc7052600951d63dfc0913b45.dip0.t-ipconnect.de. [2003:cb:c705:2600:951d:63df:c091:3b45]) by smtp.gmail.com with ESMTPSA id q16-20020a5d61d0000000b0020d110bc39esm810922wrv.64.2022.06.01.00.53.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jun 2022 00:53:07 -0700 (PDT) Message-ID: Date: Wed, 1 Jun 2022 09:53:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 To: Miaohe Lin , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins References: <20220527092626.31883-1-linmiaohe@huawei.com> <20220527092626.31883-3-linmiaohe@huawei.com> <20220530160409.c9b17085adb6112d8580f37d@linux-foundation.org> <33d6aec8-b4fc-aa37-27f4-f33984ea33d3@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH 2/3] mm/swapfile: avoid confusing swap cache statistics In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ghJYqy5x; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf21.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 28A1D1C004F X-Rspam-User: X-Stat-Signature: 6j194g3a7qme5ee33smhxdtffqngqtjq X-HE-Tag: 1654069977-763086 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 01.06.22 04:11, Miaohe Lin wrote: > On 2022/5/31 20:58, David Hildenbrand wrote: >> On 31.05.22 04:55, Miaohe Lin wrote: >>> On 2022/5/31 7:04, Andrew Morton wrote: >>>> On Fri, 27 May 2022 17:26:25 +0800 Miaohe Lin wrote: >>>> >>>>> At swapoff time, we're going to swap in the pages continuously. So calling >>>>> lookup_swap_cache would confuse statistics. We should use find_get_page >>>>> directly here. >>>> >>>> Why is the existing behaviour wrong? swapoff() has to swap stuff in to >>>> be able to release the swap device. Why do you believe that this >>>> swapin activity should not be accounted? >>> >>> IMHO, statistics, e.g. swap_cache_info.find_success, are used to show the effectiveness >>> of the swap cache activity. So they should only reflect the memory accessing activity >>> of the user. I think swapoff can't reflect the effectiveness of the swap cache activity >>> because it just swaps in pages one by one. Or statistics should reflect all the activity >>> of the user including swapoff? >> >> I'm wondering who cares and why? > > I thought it's used to show the effectiveness of the swapcache readahead algorithm. If nobody > ever cares about it now, I'm fine to drop this patch. And could these statistics be removed > since nobody cares about it? IIUC, they are printed (via show_swap_cache_info()), which is called via show_free_areas() -- primarily used via show_mem(). show_mem() is primarily used when OOM, when allocation fails and we warn, from the OOM killer, on panic(). I am not sure how useful for (OOM ?) debugging the find_success vs. find_total stats are at all. They are from ancient times. In bb63be0a091c ("tmpfs: move swap_state stats update") we removed other statistics that are "are relics of my 2.4.11 testing". Maybe find_success and find_total can be similarly removed. data_race() indicates to me that these stats are somewhat best-effort already. -- Thanks, David / dhildenb