From patchwork Fri Oct 15 06:15:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 12560063 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8493BC433EF for ; Fri, 15 Oct 2021 06:15:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0559D61090 for ; Fri, 15 Oct 2021 06:15:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0559D61090 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 93AE2900002; Fri, 15 Oct 2021 02:15:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E9DA6B0071; Fri, 15 Oct 2021 02:15:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D8BF900002; Fri, 15 Oct 2021 02:15:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0236.hostedemail.com [216.40.44.236]) by kanga.kvack.org (Postfix) with ESMTP id 6C4B86B006C for ; Fri, 15 Oct 2021 02:15:49 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 28FEB18294F8B for ; Fri, 15 Oct 2021 06:15:49 +0000 (UTC) X-FDA: 78697660818.01.2B40C7C Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf10.hostedemail.com (Postfix) with ESMTP id 28A036001987 for ; Fri, 15 Oct 2021 06:15:47 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id c29so7539576pfp.2 for ; Thu, 14 Oct 2021 23:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id; bh=Xt+EtCeoNArQpSpBl66rnuBSnoc3jprqMsF8x7P8yrE=; b=g3JD1trlBvR6kaqIdTE4CNw3T26PTdw1D3d5EbHGPJkPrvkEFC3slZsFmi2PNm/kPn SBHopm0Lp8Si6bebHVabQtIasLQYa4UpLMuZ/K9BHgdmLa4+lp1W1hvQXcG5w5XvRIf8 v9aC7V5SEEtHNoMu8cevOWdwqBCBCWLbW4wNQBzIs9r+ZNp8o6QMVI4UGKaZrAn2rVb0 960tfPst+KO2BiO55qjkSpIwuLSH4Re0MOJIRbUSiqukVVvYp39GehhtfIUiLn2i13bF APD6BANii8ovoy2c1fbYuCshS2k/z4FROQBuRTkDAx8IR6v4EjXc0Pen2uii+u9GCmvM DRWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id; bh=Xt+EtCeoNArQpSpBl66rnuBSnoc3jprqMsF8x7P8yrE=; b=nEDOFpgQscDVLVTL7YxyXbj5RmlnnSFLDwbd3CvZGkY2Byh0Bvg/TiG5qdwwaQKl6k 2JLYSDdY3AYiVfem892vbzMUX9g6JdG/GamoPTg5EvdE4uYjN+Co674NW0Rc6rw+AYn8 pn/8Bdto5SXg0+AGyKXc3Qoi+MdO7gCpuxt2kr1CxDi3dfz2UHUdQ+OfngqOMSNqQ3od keGBiZ+MJvhHL1R9mOAmChgh7uj1RnvHWa73ySYoVEtBYieGAuxOhqQNAX6GQswtBnSe 0BbOkaNsqXjJHUzci9/8HlxGD2eLmgZlYVehZoCprQnZcvVe7V+act7E//KEV7zPfOPw LZOg== X-Gm-Message-State: AOAM53038cJquUdiKKZc8jrfBHEtf/UwhTrNYwoiKqTwXw5cfNLu2IOO urdEcgNhwi+XT4Bph3Whu2k= X-Google-Smtp-Source: ABdhPJwA8WcuNRh9h6zTX9Z9hP9sts6fgUyg5NjHaYhqTs5I7Pkg+of30UMxjvnIdGQzWVOLo5TxfQ== X-Received: by 2002:a62:ea04:0:b0:44c:7370:e6d8 with SMTP id t4-20020a62ea04000000b0044c7370e6d8mr9989325pfh.18.1634278547733; Thu, 14 Oct 2021 23:15:47 -0700 (PDT) Received: from bj03382pcu.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id e24sm4045245pfn.8.2021.10.14.23.15.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Oct 2021 23:15:47 -0700 (PDT) From: Huangzhaoyang To: Andrew Morton , Johannes Weiner , Michal Hocko , Vladimir Davydov , Zhaoyang Huang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: skip current when memcg reclaim Date: Fri, 15 Oct 2021 14:15:29 +0800 Message-Id: <1634278529-16983-1-git-send-email-huangzhaoyang@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 28A036001987 X-Stat-Signature: n5a91t13ibz7fchbxffu5u4xq5p7jugr Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=g3JD1trl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of huangzhaoyang@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=huangzhaoyang@gmail.com X-HE-Tag: 1634278547-416006 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: Zhaoyang Huang Sibling thread of the same process could refault the reclaimed pages in the same time, which would be typical in None global reclaim and introduce thrashing. --- mm/vmscan.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 5199b96..ebbdc37 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2841,6 +2841,11 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) sc->memcg_low_skipped = 1; continue; } + /* + * Don't bother current when its memcg is below low + */ + if (get_mem_cgroup_from_mm(current->mm) == memcg) + continue; memcg_memory_event(memcg, MEMCG_LOW); }