From patchwork Fri Apr 8 04:57:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 12806061 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 63410C433EF for ; Fri, 8 Apr 2022 04:57:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEDF46B0071; Fri, 8 Apr 2022 00:57:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B9CB76B0072; Fri, 8 Apr 2022 00:57:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8B196B0074; Fri, 8 Apr 2022 00:57:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id 9A73C6B0071 for ; Fri, 8 Apr 2022 00:57:47 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2E658AE7AB for ; Fri, 8 Apr 2022 04:57:47 +0000 (UTC) X-FDA: 79332504174.21.53D3CA8 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by imf31.hostedemail.com (Postfix) with ESMTP id C4AB720002 for ; Fri, 8 Apr 2022 04:57:46 +0000 (UTC) Received: by mail-pg1-f202.google.com with SMTP id q13-20020a638c4d000000b003821725ad66so4169535pgn.23 for ; Thu, 07 Apr 2022 21:57:46 -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=gNaeesmpk/bm+MvfeH4duevmtiNSegapk87qzryE4Rg=; b=VpC1ILFh71v7mqF4BnD526/zj/1F9/XWSKZb9oFAzDRpeFV9yY/r/588MgB3g8zJ6y 9815ldbxekiYjWVP/6ssWMPIv1e6OOWSYXhPJD5ehrJh2cPyZkAbco6d9GNMUG8lAvY9 dgzR/DFOkStbhSrRdvZxFaSrP/VvGFLF0vj8sLGDEAsNk4dniKdJXCvpc1jyoH8QkyIS 7U6YMCqjLB+EJr/Z6ZFDhpBTUOImx4UBG+GjU4uqsmqL9rJOwxWamOcDIMkEfXdfSf8Z iNbxoOtRAxHdZOpmu11faMMTfVi93twrruvLp8IpCeBXtSA9DW3R9D6v0ehQCsPE3Eei dAKQ== 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=gNaeesmpk/bm+MvfeH4duevmtiNSegapk87qzryE4Rg=; b=ZuTmWVx58Qx2nAVNpdIM0FfU+4mGxmZnE8jN98sOOcOW/g86Mcp2NoBTvTm59O7ZFz AwrZBjWlVK0nO4N7M3KNJerS/wtz5KaMOpwLR9P1niNVfgiZPZ9lnuDLbzl/TepsoI5v i3IDLpwnmcJBGzExtNtSaB3qThPkP0LmDTBEjcE3gaipXx/BV3xRQ2l7vc6btu1su8Qo yZC/3nCT6oIXjlUeFD5tuUE5SdDs3qIpOso9/atEyRcQDuGQxKfyCRsy7wO+NNs0bCS9 vjCp+xXiaF6X0svurUDypU2+BQpoytENsmsd/tmZ9YtO8eBvBjUNkWOGW7jSIHeAsPWR MVvA== X-Gm-Message-State: AOAM531dRUSO7OdHit1PqAj1k3AHIa8yat/QcvZkyqDLE90YOsls9eTD rhlrFHi8LadnvzW8F6wyGTxboappHeklxUin X-Google-Smtp-Source: ABdhPJyZ29N+vSD30BVtv+iUBfQdlGsNN2NbT8PHWHlFuN3vXkcsq9aRVlHd3msWZm5B3br+LUtusM05DpEHehps X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a17:90b:3e82:b0:1c7:2920:7c54 with SMTP id rj2-20020a17090b3e8200b001c729207c54mr20048577pjb.2.1649393865785; Thu, 07 Apr 2022 21:57:45 -0700 (PDT) Date: Fri, 8 Apr 2022 04:57:39 +0000 Message-Id: <20220408045743.1432968-1-yosryahmed@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH v3 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 , " =?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: imf31.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=VpC1ILFh; spf=pass (imf31.hostedemail.com: domain of 3ycBPYgoKCKIaQUTaCJOGFIQQING.EQONKPWZ-OOMXCEM.QTI@flex--yosryahmed.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=3ycBPYgoKCKIaQUTaCJOGFIQQING.EQONKPWZ-OOMXCEM.QTI@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C4AB720002 X-Stat-Signature: ao4rg1jgh1yd9tzmssodzgnjbu7f54qc X-HE-Tag: 1649393866-102035 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 V3: - Fix cg_write() (in patch 2) to properly return -1 if open() fails and not fail if len == errno. - Remove debug printf() in patch 3. 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 | 32 ++++--- .../selftests/cgroup/test_memcontrol.c | 93 ++++++++++++++++++- 4 files changed, 166 insertions(+), 17 deletions(-)