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 587A4C43334 for ; Thu, 2 Jun 2022 08:42:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C02986B0072; Thu, 2 Jun 2022 04:42:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB0816B0073; Thu, 2 Jun 2022 04:42:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9B176B0074; Thu, 2 Jun 2022 04:42:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 96F826B0072 for ; Thu, 2 Jun 2022 04:42:02 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3A33F356BA for ; Thu, 2 Jun 2022 08:42:02 +0000 (UTC) X-FDA: 79532653284.20.0CBFEDA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 0E4F9C0065 for ; Thu, 2 Jun 2022 08:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654159321; 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=MXuoIf4WN2eU+uzadafzU5Y/KqghoiWZuGnVyJ/94kc=; b=NUAjThWeewXnca5+pdlR+yOmQROf6MrACL6WfnyAZV9yeBve8/36DH7j3yPJizWkDxepxN UXnRfbDUs10XWLc4exTS1Bv1A6rgH1NTGTstBfFFb6vpLVJVAUCCbQNxNdR8HJODn4USTt WpAAehTsiXwtWiEfc1av45UWlkI3H84= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-670-v_TKRi_DPM6W9ZOMMRRCHA-1; Thu, 02 Jun 2022 04:42:00 -0400 X-MC-Unique: v_TKRi_DPM6W9ZOMMRRCHA-1 Received: by mail-wm1-f72.google.com with SMTP id k16-20020a7bc310000000b0038e6cf00439so2520491wmj.0 for ; Thu, 02 Jun 2022 01:41:59 -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:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=MXuoIf4WN2eU+uzadafzU5Y/KqghoiWZuGnVyJ/94kc=; b=dvdgBRa+AtfWh+bpRp3UCgu9XkVuIIuOd+z246K07PbON3zSRRUTUNeJ3lV7svQt+c hCnClTBoDIl+dkKXY1uVDyp25xARfKpJnQViNrDTdV9Mo0pQ1HEs46Jrd4qQYqO9p9jZ X7/HmC+juY7V5b6Ydh+4V7osnt+aiJZryHeoLuSGP0RHOS0v4XANMceutVfgZrsFP7ux YR/jsGjX9eW/RtVZY3DUESSk0fQxYpoRl0It7Omtc5TYj2W31tLfWUlY+eqUeF+kgwpm sa+viDPsDCwcFpikyWglZLxavIylJG7LB3bwY7rp3qjG73OasBCurJi6mwuUYZBzB0Ko 2l9A== X-Gm-Message-State: AOAM532uYaBh58qhGt4UcN95wBH5UM+l+ql5zfuCKbwXvxsDWreA66Sr kG09+reVFNgxDfTIiuVPLcXYChwOmrT7AjLVt83eP3/w1bLcQdDf3yR7G8re0J/rgAO6nBHVVXU Xa9BMW+v0ZDc= X-Received: by 2002:a5d:52c7:0:b0:210:ac6:3956 with SMTP id r7-20020a5d52c7000000b002100ac63956mr2733030wrv.379.1654159318925; Thu, 02 Jun 2022 01:41:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxy+bZAz9peLrXzAJXRgf5aOn+EaYE5T4t2tfJFaIrD632/2BjAImz3WYzkWCezdMgMv6JQFw== X-Received: by 2002:a5d:52c7:0:b0:210:ac6:3956 with SMTP id r7-20020a5d52c7000000b002100ac63956mr2733012wrv.379.1654159318692; Thu, 02 Jun 2022 01:41:58 -0700 (PDT) Received: from [192.168.178.20] (p57a1a7d6.dip0.t-ipconnect.de. [87.161.167.214]) by smtp.gmail.com with ESMTPSA id p14-20020a05600c204e00b003974b95d897sm7542880wmg.37.2022.06.02.01.41.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jun 2022 01:41:57 -0700 (PDT) Message-ID: <5c041ef1-05ec-f49f-7ada-fa58d5aec8ba@redhat.com> Date: Thu, 2 Jun 2022 10:41:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 2/3] mm/swapfile: avoid confusing swap cache statistics To: Miaohe Lin Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins , Andrew Morton 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> <1d550b5c-1409-cb9e-5de6-476d515c9a94@huawei.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <1d550b5c-1409-cb9e-5de6-476d515c9a94@huawei.com> 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 X-Stat-Signature: fb9ekneqpas9pn91a1eqitdj9hrgao3b X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NUAjThWe; spf=none (imf10.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0E4F9C0065 X-HE-Tag: 1654159276-213090 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 02.06.22 09:29, Miaohe Lin wrote: > On 2022/6/1 15:53, David Hildenbrand wrote: >> 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. > > Maybe add_total, del_total, find_success and find_total should be similarly removed altogether? > It seems those can't provide useful info when OOM occurs? And we can thus avoid touching the > swap_cache_info cacheline. At least makes sense to me, AFAIKU, these are not statistics one could easily use to tune system performance because they are not easily accessile. Maybe simply propose removal? -- Thanks, David / dhildenb