From patchwork Thu Dec 19 20:07:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 11304341 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 B28CD109A for ; Thu, 19 Dec 2019 20:07:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5AFDE24684 for ; Thu, 19 Dec 2019 20:07:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="fj3AGRXK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AFDE24684 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F2CE78E0177; Thu, 19 Dec 2019 15:07:30 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EDCCA8E00F5; Thu, 19 Dec 2019 15:07:30 -0500 (EST) 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 DCDA88E0177; Thu, 19 Dec 2019 15:07:30 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id C7FDC8E00F5 for ; Thu, 19 Dec 2019 15:07:30 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 779321F06 for ; Thu, 19 Dec 2019 20:07:30 +0000 (UTC) X-FDA: 76282975860.24.mark87_735cfb8e1c25 X-Spam-Summary: 2,0,0,5ba0258a8a9894e4,d41d8cd98f00b204,hannes@cmpxchg.org,:akpm@linux-foundation.org:guro@fb.com:mhocko@suse.com:tj@kernel.org::cgroups@vger.kernel.org:linux-kernel@vger.kernel.org:kernel-team@fb.com,RULES_HIT:41:69:355:379:541:966:973:988:989:1042:1260:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:1801:2196:2199:2393:2559:2562:2693:2897:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3874:4250:4385:4605:5007:6119:6261:6653:6755:7875:7903:9040:10004:11658:11914:12043:12219:12297:12438:12517:12519:12683:13069:13161:13229:13311:13357:13894:14096:14181:14384:14394:14581:14721:21080:21444:21627:21740:21772:21810:30012:30054:30074,0,RBL:209.85.219.66:@cmpxchg.org:.lbl8.mailshell.net-62.14.0.100 66.201.201.201,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:29,LUA_SUMMARY:none X-HE-Tag: mark87_735cfb8e1c25 X-Filterd-Recvd-Size: 4779 Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Thu, 19 Dec 2019 20:07:29 +0000 (UTC) Received: by mail-qv1-f66.google.com with SMTP id m14so2737753qvl.3 for ; Thu, 19 Dec 2019 12:07:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oYiIu2mk1O8LA2y0MiTcNVGhftZjp6jwMi9mmwJQac4=; b=fj3AGRXKmJEfNgQiRcISC7HVWkSocovlBpyW/qprUYO7Mqg0zHOgkFsuEL7bj09x0e GNo2GUYrsgl7gu9dZcbcOreUdSZizGPe/8vnYBkegdu2BxjdPOUvTm4HQ1/a3N5I0rXy 9qpO/VYJ59U2ZDJGyC2A1xNdpYrFDsJ9gEb5CkN+86hhOcJ6Cn8RTlBgbbxf4iDPI0Tg YA+xDeChfCuXtKz4PvRQ6A8oZN68sfPVub+RuWdmP+SXFjeLsXVA8d9CtSWvc4YGlADS a3oNuCkGPu+UUDyczUUDqcEq9SzvZUSvXzvruEBOZhoP+9RWO3jTbPYNnqin1YdpVr/y er1Q== 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:mime-version :content-transfer-encoding; bh=oYiIu2mk1O8LA2y0MiTcNVGhftZjp6jwMi9mmwJQac4=; b=d0VgK/FfGILTcBp0AKtLVK2Bazmw0p5d6X9dN1eRdDIyBXL40OqxVQ7IRU2rKD+1Ys vByM9GWpoSmveysV2qet3tIu0FFDs8SaY2CREjbqE9IbTUHzfT5p6fzE2UqG/Zro13BL XrFz28Zxh0k12wdfwtFe9F/0cZIwqoxe3iyUAU1O3Vh5hKAB2t4szhMZ6bLbW7JAXUiJ YdTzHt3/YrbDP+89sGsrRaExBLx38Wm41dwyNJotTpdw0fCqPsiRJDJZaPW3utoeuFjm Vni3dNkG6WiDjkrI+7kAh+EPufzI1RP/Vs38QvfKmyc1Gn5LGJIeIiEhzl4tTwHx9PBX CB5A== X-Gm-Message-State: APjAAAVH3FMgXFGNJ9dJc9ejwl7NSmi9Mv+ngKXv/He28LilajNIR0EQ XG2Y3sAh+q0yUQNpXTBPjObFkw== X-Google-Smtp-Source: APXvYqw9MlnwX1RpRt+FpodJ+Md/4AlRpjp73kv5sZLkkuJshWziV52bT3S99wB33K3ObJsu/FL+bg== X-Received: by 2002:ad4:450a:: with SMTP id k10mr8841247qvu.136.1576786048621; Thu, 19 Dec 2019 12:07:28 -0800 (PST) Received: from localhost ([2620:10d:c091:500::91a1]) by smtp.gmail.com with ESMTPSA id g21sm1995456qkl.116.2019.12.19.12.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 12:07:27 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Roman Gushchin , Michal Hocko , Tejun Heo , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v2 0/3] mm: memcontrol: recursive memory protection Date: Thu, 19 Dec 2019 15:07:15 -0500 Message-Id: <20191219200718.15696-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 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: Changes since v1: - improved Changelogs based on the discussion with Roman. Thanks! - fix div0 when recursive & fixed protection is combined - fix an unused compiler warning The current memory.low (and memory.min) semantics require protection to be assigned to a cgroup in an untinterrupted chain from the top-level cgroup all the way to the leaf. In practice, we want to protect entire cgroup subtrees from each other (system management software vs. workload), but we would like the VM to balance memory optimally *within* each subtree, without having to make explicit weight allocations among individual components. The current semantics make that impossible. This patch series extends memory.low/min such that the knobs apply recursively to the entire subtree. Users can still assign explicit protection to subgroups, but if they don't, the protection set by the parent cgroup will be distributed dynamically such that children compete freely - as if no memory control were enabled inside the subtree - but enjoy protection from neighboring trees. Patch #1 fixes an existing bug that can give a cgroup tree more protection than it should receive as per ancestor configuration. Patch #2 simplifies and documents the existing code to make it easier to reason about the changes in the next patch. Patch #3 finally implements recursive memory protection semantics. Because of a risk of regressing legacy setups, the new semantics are hidden behind a cgroup2 mount option, 'memory_recursiveprot'. More details in patch #3. Documentation/admin-guide/cgroup-v2.rst | 11 ++ include/linux/cgroup-defs.h | 5 + kernel/cgroup/cgroup.c | 17 ++- mm/memcontrol.c | 243 +++++++++++++++++++----------- mm/page_counter.c | 12 +- 5 files changed, 192 insertions(+), 96 deletions(-) Acked-by: Tejun Heo Acked-by: Roman Gushchin Acked-by: Chris Down