Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1840699ybb; Thu, 2 Apr 2020 08:17:54 -0700 (PDT) X-Google-Smtp-Source: APiQypJyEPzbM4PFSGZb5LkIbvhKrK+DWSRqOXtlc48SRU/HejLa02Ax0TdQygRdP88N2sHvKpkt X-Received: by 2002:a9d:8d0:: with SMTP id 74mr2814365otf.39.1585840674104; Thu, 02 Apr 2020 08:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585840674; cv=none; d=google.com; s=arc-20160816; b=gWYc/EiGqgzxvfXDe9errNrsLaifzwreI/IVp6pBH4JoTO92LY+WCh50EG2DofpGTL 9rN3UOG2WQhUjbzusYg2pQE5ZXZo8xjZtaeniJboVj8BRs7AZJAu7TvHPt+WCxiVIaAq E861qU5vKL2hRh4MsaEuDAT+J8ryjXlX+mr0jRYEyzm97ew3tcXjZxsO0uuB6lW/JxRw prDSofU9c7LxNq/U6lomFuGvI5bxruiBAal09GIEjULeekDw+MDnQlKsc9TKqMfYyi2J xFe/m3Mgrhpt7J3ITB8og0W9IZtQYncQjgK9vYDbYvjN/L3eUYt7WT6z4pZ8KKklhNyP agrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6V8MAk4CYER6oFWyosg5mJivoo0UdSsXpVob3p2WcUA=; b=UohwjyZwP97I7wX2thb7gzNamos9BNJqAsfROAVBXrhMWCpkjtMyZc0QBsr1mdtJJV MxF7SQl7jtaZkbDxgyV5uA6QtbXUx1UQy+dZiJrciYkKXe0fItc6/Dy2oLaJhzQn+aN/ sfN7Rprl6ZcFXoypfHmxyYjbtnHnzoNOevy65PQuiI0wpw7ObzxYYiZWx2LZN9DP2GX9 LtsiSVSuD6aSpzYPKta5Oe2BMvWVlHb6SjMlrkK4xKO5vHQyEW2Pe1KnJYhJCkKiVAW+ 3Wb2EWVgsGz6SGliYG0G+U/2yYOwWb+ItmH9sGeWXsT0vfh3Nlix2V5ZplMJq4EPEqVf zd7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=LhmJEj2+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id f63si2160698oib.85.2020.04.02.08.17.33; Thu, 02 Apr 2020 08:17:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=LhmJEj2+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2389158AbgDBPOR (ORCPT + 99 others); Thu, 2 Apr 2020 11:14:17 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:45326 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388813AbgDBPOR (ORCPT ); Thu, 2 Apr 2020 11:14:17 -0400 Received: by mail-qk1-f196.google.com with SMTP id o18so1437369qko.12 for ; Thu, 02 Apr 2020 08:14:15 -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:content-transfer-encoding:in-reply-to; bh=6V8MAk4CYER6oFWyosg5mJivoo0UdSsXpVob3p2WcUA=; b=LhmJEj2+GFCFSn734TVbt4q8S+EnMVyq+aGwTZxgIJ7rMCzKGPFaOXro2rI/R8Jca4 xl5Lwphom5321zVvWuEqXxgsEqfCPgoU8+W40FM/m1KzHWFXOZFqZwAPVS5ArHoA0rt/ HGV4UHzmjo7hyT25K0DhY6eqidbUfdC+5glHUc8fDMfO2v9Iiyi0wqVj+ZL2nc2kL7WO 6S56NiRMmYvYL/lL02BDY8yTQtB0TZ9ZkqwTRHQNbXwcLTQNz+OvNTeg/yTDw+hJp/Le NJAz7e8i6Vrh4BiFxPWH03E4c17X4kD3msqGzZHxe1zBhSzlazbubV+eMxQI25Dxxvuv 16uA== 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:content-transfer-encoding :in-reply-to; bh=6V8MAk4CYER6oFWyosg5mJivoo0UdSsXpVob3p2WcUA=; b=oa0s11K7HnVMPJmxlUFUDEn7vit+qq6EO8qoM3baPkrolthCBPLvsCTBYP60A8uqj6 tMsvh4Uq1V/hyqj/p8PKAxYXzmAsi0zTCFSQdWEkW9Bl8LOZ/KdTBY5H9IEDfQ0fHK/M ILagh9RBMXUN8weeiYkRp1dhz6rX7YnVOoGdNNkn1KjTNvdSK0l+2Ile4lgBC7YUy9g5 hvskU50VJGjlF0dYlQe/H4EZERnd4BDfYG8Zg75/YR2ybAD9VrlMzNFmljtcBoy98zXN N8UiKQOoqVpl98W+o57GsEpdqdy7CCUKr4yyM3cRCUIXQbHtxgbyt8+4/Zi3p91gnBqr XHXg== X-Gm-Message-State: AGi0PuYiZtfgOY78RiAe+rtM6kh8mD5Fp2v/t3OVXgyOJYT24WwtMnTw CC37DtrHeYlBtbdPWJAzX1wRUw== X-Received: by 2002:a37:d244:: with SMTP id f65mr4075727qkj.373.1585840454760; Thu, 02 Apr 2020 08:14:14 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::11c9]) by smtp.gmail.com with ESMTPSA id 124sm3765499qkl.31.2020.04.02.08.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 08:14:14 -0700 (PDT) Date: Thu, 2 Apr 2020 11:14:13 -0400 From: Johannes Weiner To: Joonsoo Kim Cc: Andrew Morton , Linux Memory Management List , LKML , Michal Hocko , Hugh Dickins , Minchan Kim , Vlastimil Babka , Mel Gorman , kernel-team@lge.com, Joonsoo Kim Subject: Re: [PATCH v4 6/8] mm/swap: implement workingset detection for anonymous LRU Message-ID: <20200402151413.GC2089@cmpxchg.org> References: <1584942732-2184-1-git-send-email-iamjoonsoo.kim@lge.com> <1584942732-2184-7-git-send-email-iamjoonsoo.kim@lge.com> <20200323171744.GD204561@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 02, 2020 at 02:50:28PM +0900, Joonsoo Kim wrote: > 2020년 3월 24일 (화) 오후 3:25, Joonsoo Kim 님이 작성: > > The problem looks not that easy. Hmm... > > > > In current code, there is a large time gap between the shadow entries > > are poped up and the page is charged to the memcg, especially, > > for readahead-ed pages. We cannot maintain the shadow entries of > > the readahead-ed pages until the pages are charged. > > > > My plan to solve this problem is propagating the charged mm to > > __read_swap_cache_async(), like as file cache, charging when > > the page is added on to the swap cache and calling workingset_refault() > > there. Charging will only occur if: > > > > 1. faulted page > > 2. readahead-ed page with the shadow entry for the same memcg > > > > Also, readahead only happens when shadow entry's memcg is the same > > with the charged memcg. If not the same, it's mostly not ours so > > readahead isn't needed. > > > > Please let me know how you think of the feasibility of this idea. > > Hello, Johannes. > > Could you let me know your opinion about the idea above? > In fact, since your reply is delayed, I completed the solution about the > above idea. If you want, I will submit it first. Then, we could discuss > the solution more easily. It's probably easiest if you send out your implementation and we discuss it over the code. Thanks!