Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp898779pxb; Fri, 22 Apr 2022 13:46:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQQRL+AxHKzAMm8Kxe4NBYjPTmJ2SC6Ke8I7/fUazaxUsZvrCPzVFYpM1fiHsFPEuU6al5 X-Received: by 2002:a63:854a:0:b0:3aa:ed49:b5c1 with SMTP id u71-20020a63854a000000b003aaed49b5c1mr856224pgd.277.1650660390964; Fri, 22 Apr 2022 13:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650660390; cv=none; d=google.com; s=arc-20160816; b=zPu0+JNhvfG8O9FWpl5bifyzDPv7oFHi4EXc32VfFZwUjrx5HESk8I8AHansS2Y4Jn AbvQ59AWmSQtmKZUCawS7fcgqUXCIStedcvZENSEjw4cGDy/KlR8NX/Ziq0I9N6FTUFz CjgvQA8qj9tAGZVFoYnwI7eLw8RSfgzTTngFNIEW6CiCMiBD/FmzPWm83W4KhA/niOEx L5Zz2twi329ddDS0im3gTAF40pXov373rQmsnFWJeu2LSB0PdzKIKqpWFOVNv41fCBtL J+JUpPOvWrMgH0wb2JU9/CtC8USYHks78jf3Br+tQ/MnoxeMcxuZf5AyKzOjwjEgfdie 2HtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=5O0kxWZmLwFRE//70CU4SnK5FsmrfXu8oMUA9u7C7Og=; b=IlUXSG27zvCbY57pSwMaipARziEXqL0gQSrDCS9z1Pqxk//SpQHnPhXd4L3FQXrdj/ /6bj8GvF2SlbYFjvqi8zXGPhGqBX3LpEABAacV736daR+514DlsLRK5cONwVmtzBhvGs 5FShxTVETTZSFigV7UhVvMzSVFr9rdNNYYdrJAvEnnNNNHrhR43vLXKQY9C7ei1G3Bha FDR1PAHhAq3/0hnMtCk/2lt5uJsnAZtaSl5qfG37cjeditWXVC7v/AL7OEcH6hp+stJa qJFTLY+erYP9FaegUnOCSjZMLTW0XL9Ld5BNcmF0AhvhwpKTq4jzSnQXA1vnMf60fqGG Zb0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=EEuRmGT5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x23-20020a63f717000000b0039ce0b60072si9983909pgh.873.2022.04.22.13.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 13:46:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=EEuRmGT5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3CF462D5E54; Fri, 22 Apr 2022 12:34:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442710AbiDUXre (ORCPT + 99 others); Thu, 21 Apr 2022 19:47:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352487AbiDUXrc (ORCPT ); Thu, 21 Apr 2022 19:47:32 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E2BD47078 for ; Thu, 21 Apr 2022 16:44:41 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id q13-20020a638c4d000000b003821725ad66so3569255pgn.23 for ; Thu, 21 Apr 2022 16:44:41 -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=5O0kxWZmLwFRE//70CU4SnK5FsmrfXu8oMUA9u7C7Og=; b=EEuRmGT5N/AhXYspmngFDGUt6HR2mHaVhu/fczoNdkx1S+Tiw4e5ODeE/h0GtPvaG2 bvqoiL5mnjZ/aduPS9JOdCT/WFHetjHQ/fFxUMLwUz2iHstQGYdLFY9nEc3RGO/pFRId m0WQO8I7VArJ1uX3NbmYYEA88ykvSfC0OpSqsvj5vs/DO49GYszGs0S7tk5R8f4jxym8 I2h1Y/p24TBtaEZqcwGkSWTlCVdJnfbO6lXa5S28c65m4gPlKPQoodGuay5Lob9zUCDG 714Wv7IzMi+PqiG7UTFB2mdWmfKUmZO1+0ChdhKc8za/syH6jJBY1fE/GNCPODAwzk8P Nyvw== 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=5O0kxWZmLwFRE//70CU4SnK5FsmrfXu8oMUA9u7C7Og=; b=zLeoW5H1kd1yir++lmvLt9c+pVJoEG0yvdNGd9X6p7wtSkKrYNijharyeueRU+0KAr cgQ/4u1SP5ncojD4Wi+/4r8478hvTI1m74JYAsyla1qtaHt07xAbQ2scp8/eYt2Ge9Qy ZWNlge+XkR9Wy7Xs87OgWEOxAr1KEiGDqzzrFK+rXZL/6GM7NtHsAdrGl8/7mHu8m3eY F+IkbShUGXPeMzoD2qlJ2zqLZucAD49qZDhuSrBohIJnt2COnq5acuPgXHCSm8BzeLEH IL5apOM9gYktz0QY3v90gP1QV/VkElOw+tYsbX6IHNkUvzcp3FN1iu6tGm0Orru+d8+4 3Mqg== X-Gm-Message-State: AOAM532uqwQ3skQ1i8G+WM8uwkegBukR/iP8Bk3ghmho7VWsA0aTo8V1 soHCvYt14xApwc+HAscEhYfLu5hHLlWE90a2 X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a65:6216:0:b0:39d:5e6c:7578 with SMTP id d22-20020a656216000000b0039d5e6c7578mr1558461pgv.114.1650584680523; Thu, 21 Apr 2022 16:44:40 -0700 (PDT) Date: Thu, 21 Apr 2022 23:44:22 +0000 Message-Id: <20220421234426.3494842-1-yosryahmed@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog Subject: [PATCH v4 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=20Koutn=C3=BD?=" , Tim Chen , Dan Schatzberg , 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 V4: mm/memcontrol.c: - Return -EINTR on signal_pending(). - On the final retry, drain percpu lru caches hoping that it might introduce some evictable pages for reclaim. - Simplified the retry loop as suggested by Dan Schatzberg. selftests: - Always return -errno on failure from cg_write() (whether open() or write() fail), also update cg_read() and read_text() to return -errno as well for consistency. Also make sure to correctly check that the whole buffer was written in cg_write(). - Added a maximum number of retries for the reclaim selftest. 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 added 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 -errno from cg_read()/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 | 44 +++++++++ tools/testing/selftests/cgroup/cgroup_util.c | 44 ++++----- .../selftests/cgroup/test_memcontrol.c | 94 ++++++++++++++++++- 4 files changed, 176 insertions(+), 27 deletions(-) -- 2.36.0.rc2.479.g8af0fa9b8e-goog