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=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 D8754C433E0 for ; Wed, 27 May 2020 02:06:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 94C652075F for ; Wed, 27 May 2020 02:06:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UKtenuWI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94C652075F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1F224800B6; Tue, 26 May 2020 22:06:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A2EA80010; Tue, 26 May 2020 22:06:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B8EF800B6; Tue, 26 May 2020 22:06:58 -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 E61B180010 for ; Tue, 26 May 2020 22:06:57 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A79E4180AD81F for ; Wed, 27 May 2020 02:06:57 +0000 (UTC) X-FDA: 76860860874.26.flock89_62002d926d4e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 87DB11804B661 for ; Wed, 27 May 2020 02:06:57 +0000 (UTC) X-HE-Tag: flock89_62002d926d4e X-Filterd-Recvd-Size: 5126 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Wed, 27 May 2020 02:06:56 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id b6so22921156qkh.11 for ; Tue, 26 May 2020 19:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZUi+y+kpl/dFHCzojn4fvs0wctouGkeBE98eyOM61ec=; b=UKtenuWIwIc+kT7nWPl8E+OCr/W5y/OJXy3ZyIEh4fat/20lp73fqB2CcAgAZBW7P3 CyFpEDC/PvWhTwkZA1af47/VqgWPVbKnMRBoxK4WJ4z6aJOfR+JgGqCJysDRTWv45tSQ YLb3DLACzu3ybIoQzi8F4RUt7Ae2FvYb6eVJzSTBRyuEl9HUlG1cfvkGO7rnFnbiIWls ABbDPbOgWMBi83CUW1SEMVefbF6KboDgMLC3gUEk2EzAncRzSnzmcIT+8GtQs1WBSt4j 0RhCT0uENMtdMXnklttY1bbyDxqcwfzphGP4yqy5zgrFZa7BaXrjCs9Fi562zcy74tAh 47yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZUi+y+kpl/dFHCzojn4fvs0wctouGkeBE98eyOM61ec=; b=FGk51cIAx7t9DMir6segNkUB7PSTcGVEPBDfZ5xHbhdX9fkvEw+av0CyV4Yio8aGjZ ke35CKYQzZKVn2wwxxSWghqskQymgZzuaNhwVwQVCFlRCcZ0c3kECVl4vvdq9sxhBWdM iWh8Y8jwsYtqBFEW8LhGZhS43sNkOv5BAX+wYAf09dUKyLqLdpMCoSoZSLPyaGpsI940 kAOPnmznyuruVmpx22cbZzXPGkK5spapfHj9KfSNETipmMMbD0inp90WT21qrV1SWRXA 0GLeym19RX31/QqPoNtg3kz0SwwQcP4knG25JsyanNGpfYnEUjdCll8l8aEUpqgpBQla qzJQ== X-Gm-Message-State: AOAM531VzrUHpZFPUdy01PEF7IlbKmSZ5cA2hd9iPp0vRZLJU8bmr8U3 Lf0zl2kQ1Bx/nVWOpHP9CyspH82uV8lmqLA/k1g= X-Google-Smtp-Source: ABdhPJwvx49dn7hYu3sdn1SdPWCkEH8F5BhYt2KXTPPwomO4l89A4X+/DXZRzA26IADc4/M7Lz/2bWvPhonqMWskVn8= X-Received: by 2002:a05:620a:164c:: with SMTP id c12mr1719461qko.343.1590545216375; Tue, 26 May 2020 19:06:56 -0700 (PDT) MIME-Version: 1.0 References: <20200520232525.798933-1-hannes@cmpxchg.org> <20200520232525.798933-6-hannes@cmpxchg.org> In-Reply-To: <20200520232525.798933-6-hannes@cmpxchg.org> From: Joonsoo Kim Date: Wed, 27 May 2020 11:06:47 +0900 Message-ID: Subject: Re: [PATCH 05/14] mm: workingset: let cache workingset challenge anon To: Johannes Weiner Cc: Linux Memory Management List , Rik van Riel , Minchan Kim , Michal Hocko , Andrew Morton , Joonsoo Kim , LKML , kernel-team@fb.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 87DB11804B661 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000089, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 2020=EB=85=84 5=EC=9B=94 21=EC=9D=BC (=EB=AA=A9) =EC=98=A4=EC=A0=84 8:26, J= ohannes Weiner =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > We activate cache refaults with reuse distances in pages smaller than > the size of the total cache. This allows new pages with competitive > access frequencies to establish themselves, as well as challenge and > potentially displace pages on the active list that have gone cold. > > However, that assumes that active cache can only replace other active > cache in a competition for the hottest memory. This is not a great > default assumption. The page cache might be thrashing while there are > enough completely cold and unused anonymous pages sitting around that > we'd only have to write to swap once to stop all IO from the cache. > > Activate cache refaults when their reuse distance in pages is smaller > than the total userspace workingset, including anonymous pages. Hmm... I'm not sure the correctness of this change. IIUC, this patch leads to more activations in the file list and more activa= tions here will challenge the anon list since rotation ratio for the file list will be increased. However, this change breaks active/inactive concept of the file list. active/inactive separation is implemented by in-list refault distance. anon list size has no direct connection with refault distance of the file list so using anon list size to detect workingset for file page breaks the concept. My suspicion is started by this counter example. Environment: anon: 500 MB (so hot) / 500 MB (so hot) file: 50 MB (hot) / 50 MB (cold) Think about the situation that there is periodical access to other file (10= 0 MB) with low frequency (refault distance is 500 MB) Without your change, this periodical access doesn't make thrashing for cach= ed active file page since refault distance of periodical access is larger than the size of the active file list. However, with your change, it causes thrashing on the file list. In fact, I'm not sure that I'm thinking correctly. It's very complicated for me. :) Please let me know if there is a missing piece. Thanks.