From patchwork Thu Apr 7 22:42:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 12805877 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24214C433F5 for ; Thu, 7 Apr 2022 22:43:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8F97F6B0072; Thu, 7 Apr 2022 18:43:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 880806B0073; Thu, 7 Apr 2022 18:43:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F9FF6B0074; Thu, 7 Apr 2022 18:43:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 5E0936B0072 for ; Thu, 7 Apr 2022 18:43:00 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 220EC80827 for ; Thu, 7 Apr 2022 22:42:50 +0000 (UTC) X-FDA: 79331559300.17.EC95065 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by imf30.hostedemail.com (Postfix) with ESMTP id A16A480003 for ; Thu, 7 Apr 2022 22:42:49 +0000 (UTC) Received: by mail-pj1-f74.google.com with SMTP id e12-20020a17090a7c4c00b001cb1b3274c9so1481344pjl.4 for ; Thu, 07 Apr 2022 15:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=6TC/fcsrdvkufWtZCTMpd2QTNgth1gYBFeUR7KMTO3o=; b=LTNa5mWxit+bHznZj3tr4HARnvMRLGMcNuJSn+VXMiSstVWYzjo8RrN+E1ms6VTeiU nFOM753PV0ux/FjpS7u2I8H53Ls+iBrNQ2VqMkJ4/013wYWzOkTOMvmPlfAViGmsT7JI wz5hfFfmebTV4K8w6FLtQJbWTKHCf1RVY3yK5HCK8UW5AxATe0Hhq4JXxY2zummMacbw 7WdJ0FJA8Bcsx0SQlqs5lD1wWFqEVYOi93AQ+e8nhUdpDGM/3Zb7Qs408eH4czs6r98a v6ypkffmKqRINf6d0u5JEFrGrfWgcL+egNOTvvTXneQR/WkDoHb0cWVv6VuyGlMHSD9n t4YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=6TC/fcsrdvkufWtZCTMpd2QTNgth1gYBFeUR7KMTO3o=; b=5qYmsQFhe/vPWXB3oojWeO3YPCwiaRit4o6/WuKo5spW4/HyEEsi6KEdpWxSvBDVxK 4+1CC8XZe1S//0s/D0g2iWcOZhxjGjF+5ySwt2Mhyib8tZcRQOHu40J26qRpVK4gXlje 81Z23SMM9XDd3zWIL49zucxJDolAujEZJhtwuNlWKtjeu0dXwm3d+bp2EEupwbUDkQls 7pZmYTEJ6HRo/h80xQg6ejlt/mtCLb6iC8CIhTORC72mCvCsFJVhZnLc8O/vu1vKX+Vx r/0GNtOBkkQyDyx31KSRqscbDewlma0zx0Z65YCQojjCQdb7NbKFX88beLJE6o+zN4tl XK0g== X-Gm-Message-State: AOAM532Cp8ek/VDw9Nh/QFc88hO5kNz5Mk9eJP17eU0XUZEi8Xz/mlqx JvFog1Cra7I2gNMI2tKwP9KHj/XjxJvl2m3/ X-Google-Smtp-Source: ABdhPJwlNJ+NsHyswmzk8S8aUJPENy0C4JQyTzYFWx7UJ9STkknW1VVVp9zPNMHpVNXpn76wXS46DNMY8mlzVMZv X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a65:4b8f:0:b0:39c:c85d:7e7a with SMTP id t15-20020a654b8f000000b0039cc85d7e7amr4074145pgq.324.1649371368364; Thu, 07 Apr 2022 15:42:48 -0700 (PDT) Date: Thu, 7 Apr 2022 22:42:40 +0000 Message-Id: <20220407224244.1374102-1-yosryahmed@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH v2 0/4] memcg: introduce per-memcg proactive reclaim From: Yosry Ahmed To: Johannes Weiner , Michal Hocko , Shakeel Butt , Andrew Morton , Roman Gushchin Cc: David Rientjes , Tejun Heo , Zefan Li , Jonathan Corbet , Shuah Khan , Yu Zhao , Dave Hansen , Wei Xu , Greg Thelen , Chen Wandun , Vaibhav Jain , Huang@google.com, Ying , " =?utf-8?q?Michal_Koutn=C3=BD?= " , Tim Chen , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Yosry Ahmed X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=LTNa5mWx; spf=pass (imf30.hostedemail.com: domain of 36GhPYgoKCBEF598Fry3vux55x2v.t532z4BE-331Crt1.58x@flex--yosryahmed.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=36GhPYgoKCBEF598Fry3vux55x2v.t532z4BE-331Crt1.58x@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A16A480003 X-Stat-Signature: uxf7izibc715n4hh5xtwjh4dy3syc99r X-HE-Tag: 1649371369-586124 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: This patch series adds a memory.reclaim proactive reclaim interface. The rationale behind the interface and how it works are in the first patch. --- Changes in V2: - Add the interface to root as well. - Added a selftest. - Documented the interface as a nested-keyed interface, which makes adding optional arguments in the future easier (see doc updates in the first patch). - Modified the commit message to reflect changes and add a timeout argument as a suggested possible extension - Return -EAGAIN if the kernel fails to reclaim the full requested amount. --- Shakeel Butt (1): memcg: introduce per-memcg reclaim interface Yosry Ahmed (3): selftests: cgroup: return the errno of write() in cg_write() on failure selftests: cgroup: fix alloc_anon_noexit() instantly freeing memory selftests: cgroup: add a selftest for memory.reclaim Documentation/admin-guide/cgroup-v2.rst | 21 +++++ mm/memcontrol.c | 37 ++++++++ tools/testing/selftests/cgroup/cgroup_util.c | 11 ++- .../selftests/cgroup/test_memcontrol.c | 94 ++++++++++++++++++- 4 files changed, 156 insertions(+), 7 deletions(-)