Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3367802ybb; Sun, 22 Mar 2020 22:53:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vslowEvKLv/HBoReYQHVHOA3pTWZnY7bYCsiSxKW8TVsVDq/TJFx1t9vX6wORv9TpYCfEfa X-Received: by 2002:aca:1913:: with SMTP id l19mr5536005oii.12.1584942833647; Sun, 22 Mar 2020 22:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584942833; cv=none; d=google.com; s=arc-20160816; b=00II/jGIlQoHN5qEGgBRnG7c/DTTPIXmAtyqiUD5iKIirJvB/ASVcMIOY9pRTGyOO6 WtDrL5b9em72La4sB+96gbM+DjUZ5/LMy0DNNqyPclESg/OuQRav9USxeLUdltnqCqaV QiwpsLzA18R8ujgw5o/mbayq/cZT+97HpOyJtWaCFjdxdy3oB/jcMwRxCGRFvRk6lYDc DdyC4qf7zh87evwBVr4/YNBzAqEJ2EzfiXGZyZqJRFhrZ9brcRBRycdeJNhlBsjmZQ8c zyD7D2KEKfo0QalFyXAKzgK87vdjz707b7MStQKxNM5yk9dRTCX/Mq/yXSrxvbN2zxGd yAcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=j6iK115r4yAzPkHgkiyJxNjSgms6sufr4Xa73STF5NU=; b=ou4DYcBAzRtyNrLfwF6nPTC3rIp6NkkIBUTPNDfQlUq4TmiJDp95z6DPN+FpYaaWJy c+987TM1SRltHQRn1XdLTsXs/53pnlF+jydIHGB5diTTSJKxBo1PyH/20MQyYjj0Ujc+ 5pnQz6DfrxXgMQT3CWs5B5Dgh6LsjpsgAytJbh3pbeXUCVBsL3qopjgt0deGW1RKf7ru mKfULCIt7b4vFsuK07zlICLB8LJfSsS0ztpcXxaUR4HNGKs3wY145LdV2uKGeb2NfbjX Qkw0Lsp36H5T44eGQrbAqZAWtyQJTAM/qK68Y0q75vWb2D2xuHgbTLNsc5eeCYt7tn2J 8Dtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MhbjjMzH; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si7247933oig.108.2020.03.22.22.53.41; Sun, 22 Mar 2020 22:53:53 -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=@gmail.com header.s=20161025 header.b=MhbjjMzH; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727328AbgCWFwt (ORCPT + 99 others); Mon, 23 Mar 2020 01:52:49 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38637 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727253AbgCWFwt (ORCPT ); Mon, 23 Mar 2020 01:52:49 -0400 Received: by mail-pf1-f194.google.com with SMTP id z25so2642914pfa.5 for ; Sun, 22 Mar 2020 22:52:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j6iK115r4yAzPkHgkiyJxNjSgms6sufr4Xa73STF5NU=; b=MhbjjMzHYMVqut2cxjnRgSo4EzX/RmSpB+NTDaZJlIyJPLHdIGtwn2W90ekr7noqsy ZgvlnsLH/A/9OksZ+dM68Nkmsukei9TQVt24kt9/n9+P1qMjVAuagaUUgYzBEDuaX8pG 0E02S14KWAGYZfwuelei0KPOpyEfxT62v3XUzt7sCTqTf0K/kWLLCvGZE1C+M3LZ9Xj1 dkk9Kmwqd/Tz2gHENJqmU/Pa6AZkTWGQD3X+id7GF4Q1NCneOQYWSSEN3OBHkd4jkhkl PiahZHukZV9OWCv79YCX3h4FiFchwU3xh60ujYOsqE8G6cOQqAVygojyxChwtdyNWXGD aHjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j6iK115r4yAzPkHgkiyJxNjSgms6sufr4Xa73STF5NU=; b=Hj55HEQQYfUInmKqpPq0cHiMoA9ET2gah0e70YYPZoJPEBFuff/D9nVeB3NiQdgoSX SENVYFKMDjUz/CkPX/i9sGCL7r+U6aSTejV0Jj7+tmNfOg735erUqbpTK1+QZvY495L3 grQptr44cFQxMWN5fmrIwZeQ2trh8s4e1awDG5ecquk46c/LPbGQ6/PYB/50ARrP0Y81 4nf6Kf5R/F2GJvKCFXa2uEADyby52eK+maQRNJm7H7ktBjdciaNKtNKHzsFPiusEhoT4 jfZgbsouMQYXYg+fUUiRL40MBlgqFYVIzfqu6/P+sucf3MPFNpuDD9Jo5cTK2iAyBL6c flOg== X-Gm-Message-State: ANhLgQ10yeEYOBgz5CVNCt2b2etOIxWRaygEHeDviSqggEWC/3yuYoPg uFy2IUJMwJ1wJ0QhexOavMo= X-Received: by 2002:a65:641a:: with SMTP id a26mr13873989pgv.247.1584942766280; Sun, 22 Mar 2020 22:52:46 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id y30sm12563058pff.67.2020.03.22.22.52.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Mar 2020 22:52:45 -0700 (PDT) From: js1304@gmail.com X-Google-Original-From: iamjoonsoo.kim@lge.com To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Hugh Dickins , Minchan Kim , Vlastimil Babka , Mel Gorman , kernel-team@lge.com, Joonsoo Kim Subject: [PATCH v4 5/8] mm/workingset: handle the page without memcg Date: Mon, 23 Mar 2020 14:52:09 +0900 Message-Id: <1584942732-2184-6-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1584942732-2184-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1584942732-2184-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joonsoo Kim When implementing workingset detection for anonymous page, I found some swapcache pages with NULL memcg. They are brought in by swap readahead and nobody has touched it. The idea behind the workingset code is to tell on page fault time whether pages have been previously used or not. Since this page hasn't been used, don't store a shadow entry for it; when it later faults back in, we treat it as the new page that it is. Signed-off-by: Joonsoo Kim --- mm/workingset.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mm/workingset.c b/mm/workingset.c index 59415e0..8b192e8 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -257,6 +257,19 @@ void *workingset_eviction(struct page *page, struct mem_cgroup *target_memcg) VM_BUG_ON_PAGE(page_count(page), page); VM_BUG_ON_PAGE(!PageLocked(page), page); + /* + * A page can be without a cgroup here when it was brought in by + * swap readahead and nobody has touched it since. + * + * The idea behind the workingset code is to tell on page fault + * time whether pages have been previously used or not. Since + * this page hasn't been used, don't store a shadow entry for it; + * when it later faults back in, we treat it as the new page + * that it is. + */ + if (!page_memcg(page)) + return NULL; + advance_inactive_age(page_memcg(page), pgdat, file); lruvec = mem_cgroup_lruvec(target_memcg, pgdat); -- 2.7.4