From patchwork Mon Mar 23 05:52:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11452383 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 338C192A for ; Mon, 23 Mar 2020 05:52:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F417720714 for ; Mon, 23 Mar 2020 05:52:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MhbjjMzH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F417720714 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 081F46B000C; Mon, 23 Mar 2020 01:52:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 059E36B000D; Mon, 23 Mar 2020 01:52:48 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB0866B000E; Mon, 23 Mar 2020 01:52:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id D2DB76B000C for ; Mon, 23 Mar 2020 01:52:47 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 143A04DCB for ; Mon, 23 Mar 2020 05:52:48 +0000 (UTC) X-FDA: 76625558016.04.toes64_6fba838014633 X-Spam-Summary: 2,0,0,6972d6732a9312ca,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3867:3868:3870:3871:3872:3874:4250:4321:5007:6261:6653:7576:7903:8957:9413:9707:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:13069:13161:13229:13311:13357:14096:14181:14384:14394:14721:21080:21444:21451:21627:21666:21740:21990:30012:30054,0,RBL:209.85.210.193:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:0,LUA_SUMMARY:none X-HE-Tag: toes64_6fba838014633 X-Filterd-Recvd-Size: 4608 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Mar 2020 05:52:47 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id l184so6983071pfl.7 for ; Sun, 22 Mar 2020 22:52:47 -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=sjUTHbsp/5tEaO9AGSza55kpoZ5z/V2PJmpFE2P3yhMGmuvi8ip/3bs3+hQN9Nbq01 Nj40hQw9Xp3g7tPCwJm/ifdXC263g+X8ABMvSXIWgsmso/eG0yITDpXi9mqOWIcfNqzo n/cW/2IZYdH/JzrnDHFwMstJ8XvgT6nwIWtLtOWAZ3wXR6HqjssMDuT2zhcIqmyfwrYi L/e451/7Mo7NaHdJSTGD+XGrOjvPQ9mroc5c1Gz42Dl3OCAYoCT6VkOhclyfEibXPLY/ G1yvk8w91pEGW6HZrfQJhjS0TiZM4ZAo8bwZvLr8IPuDkbDszXF6yNDbqSysCH5U236q M0mQ== X-Gm-Message-State: ANhLgQ1q4T/EiRsChM+/kTdA1rCGvctIV3aAC/IOdymG/oTFY7bsvwEy S2AWWE3uoWTiLFoVs+IfU9Y= X-Google-Smtp-Source: ADFU+vuuqKs7zJRbxUVUMawYsBYRVOcpKxBqEI48FeeqPqBtqZ8stvfIg91WljIs4dIh07BgiEwzHA== 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> 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: 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 Acked-by: Johannes Weiner --- 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);