From patchwork Sat Apr 25 15:24:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 11509925 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 900621667 for ; Sat, 25 Apr 2020 15:24:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5D4DA2071E for ; Sat, 25 Apr 2020 15:24:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Tzmc7YB2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D4DA2071E 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 3A5B18E0005; Sat, 25 Apr 2020 11:24:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 308328E0003; Sat, 25 Apr 2020 11:24:42 -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 1D1178E0005; Sat, 25 Apr 2020 11:24:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 011A68E0003 for ; Sat, 25 Apr 2020 11:24:41 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AE076584F for ; Sat, 25 Apr 2020 15:24:41 +0000 (UTC) X-FDA: 76746749562.27.jail28_28f5595f7f12e X-Spam-Summary: 2,0,0,fb71cecc21ae3b40,d41d8cd98f00b204,laoar.shao@gmail.com,,RULES_HIT:41:69:355:379:541:800:967:973:988:989:1260:1345:1437:1534:1541:1711:1730:1747:1777:1792:2393:2525:2559:2563:2682:2685:2692:2859:2897:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4605:5007:6261:6653:7514:7875:7903:9025:9413:10004:11026:11658:11914:12043:12048:12291:12296:12297:12438:12517:12519:12555:12679:12683:12895:12986:13069:13153:13161:13228:13229:13311:13357:13846:14095:14181:14384:14394:14687:14721:21080:21433:21444:21451:21627:21666:21749:21811:21972:21990:30054:30070,0,RBL:209.85.215.195:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.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:23,LUA_SUMMARY:none X-HE-Tag: jail28_28f5595f7f12e X-Filterd-Recvd-Size: 4206 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Sat, 25 Apr 2020 15:24:41 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id r4so6131958pgg.4 for ; Sat, 25 Apr 2020 08:24:41 -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; bh=KSDnmeL7kbYO0entEoKpb+EP26Hv9eZaDGSTgBmwruM=; b=Tzmc7YB2i/Fouhfcdf1EfgkJ6iPwJxuS53LmQl23+zdhyPnX1yPhMdw2EwLt2IIpW0 SGTAxTL0r1kZ5OelWSgsm/S7pdYUAEM6NfK/+4sse0sI8h6np6kwJ91PxGslv1k4GkvO LQ1e7fuSV15A1wMoos6SvhDTMJudMFB7KYnuyT20o+3i4bZ5Cq6aoSaDDXXhTjOUTsbz NXnYAjf4+DUqt+1ZZStYmvIgofTDik8IqBq4WDew0M6s8nNhPSHe1Koth5Chwb3+wWms vhvqUhyPl6H7IjpCnvS8CwfnEKlfMKsB8z3jpcJSt/jsSWRR5kFG5LIlbLVdtELmzlWK OJ4w== 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; bh=KSDnmeL7kbYO0entEoKpb+EP26Hv9eZaDGSTgBmwruM=; b=ELfyY2ql7mG94jW8uEaTvFS2TFNqbqm6enpJnh/L4/pshHEBTqVU/UV0CCSQFWVGqz CofT4wlsG9MpgnZsIANSLF2igO2hhgWOQMoVxs1hvApc5v8IW9EGG7+3psm1rZNgcK1B sjfHtYmqi4ZwQnAocEEngKnfovwW/vTX5l+N/9foLQcKIpbcfgn6S0TbiTqaGd4THnfN J2w1mRtRdd00wE5mkSgWIsGJJkdEVYqh90kFVQymGTLA2jr46VjHuhQCn0DlLFkS8Nay DnHnzlY7Rk/1MgzuBLvn+j4K8vabyNn6r7x2liKJEsmdcDxBx1mzsuxWNTSqh894MFeJ Z5cw== X-Gm-Message-State: AGi0PubFLiW9n7Xb0QVIqssE5ruvtXQ2JwoyxZib9bCTBjB0juLP+kbl 3KfRGQFTiaMrNO0DPYtGTIk= X-Google-Smtp-Source: APiQypIG5/LUaayEMzy9JpMAdfe7laJx1T7Obq8DNgGakaMU4JHtUEuHPhB0rx9mP5kqHLU2TrFYCw== X-Received: by 2002:a63:1c25:: with SMTP id c37mr14962497pgc.320.1587828280413; Sat, 25 Apr 2020 08:24:40 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id w11sm7319838pgj.4.2020.04.25.08.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Apr 2020 08:24:39 -0700 (PDT) From: Yafang Shao To: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, guro@fb.com, chris@chrisdown.name Cc: linux-mm@kvack.org, Yafang Shao Subject: [PATCH 0/3] mm: improve proportional memcg protection Date: Sat, 25 Apr 2020 11:24:15 -0400 Message-Id: <20200425152418.28388-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.18.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000112, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Since proportional memory.{min, low} reclaim is introduced in commit 9783aa9917f8 ("mm, memcg: proportional memory.{low,min} reclaim"), it have been proved that the proportional reclaim is hard to understand and the issues caused by it is harder to understand.[1]. That dilemma faced by us is caused by that the proportional reclaim mixed up memcg and the reclaim context. In proportional reclaim, the whole reclaim context - includes the memcg to be reclaimed and the reclaimer, should be considered, rather than memcg only. To make it clear, a new member 'protection' is introduced in the reclaim context (struct shrink_control) to replace mem_cgroup_protection(). This one is set when we check whether the memcg is protected or not. After this change, the issue pointed by me[1] - a really old left-over value can slow down target reclaim - can be fixed, and I think it could also avoid some potential race. Patch #1 and patch #2 is the preparation of patch #3. [1]. https://lore.kernel.org/linux-mm/20200423061629.24185-1-laoar.shao@gmail.com Yafang Shao (3): mm: move struct scan_control into internal.h mm: add reclaim context as a new parameter in mem_cgroup_protected() mm: improvements on memcg protection functions include/linux/memcontrol.h | 34 ----------- mm/internal.h | 101 +++++++++++++++++++++++++++++++ mm/memcontrol.c | 66 +++++++++++++++------ mm/vmscan.c | 118 ++----------------------------------- 4 files changed, 152 insertions(+), 167 deletions(-)