Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2096910rwr; Sat, 6 May 2023 05:00:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4uY6kjAZSDSXM3fs5Qyc7BfwhL4q3LKY/lK0HZXIcPWuFuLHhbuLVJmrUGsM4o91sZaF2h X-Received: by 2002:a17:90a:fc90:b0:24b:c580:1ab8 with SMTP id ci16-20020a17090afc9000b0024bc5801ab8mr4228431pjb.40.1683374455935; Sat, 06 May 2023 05:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683374455; cv=none; d=google.com; s=arc-20160816; b=yv29BTLMbAykDavJ//9B5Dz++ail8l5QlaTe9kVfLkFZPyJT+nk+gGOeLNjCqn5EaP Cp/U/0Vl6gBALYLum6q/L89D10yrLIr7Dcx+DQjRIslMu/4nBCFjb7Bm6c014oJJksYL kZ7RH1M/Gy4RdPI3NQX48JEBw/rupTSWCN32dxHMxRmTrgiU4joNPSGmDZehiDEdXcve DbtIvbCqz8hca+dlR14iVqWeLR5Mqbc1bjno6GQbdKEsGGull4S7R6i2gJfSLSPSz7Ff Cl7Kr4Zpwyx6SIZpreP2WWBr1Y88O9cGayLbd1J8tfyaPiG/D0BS5/LX3+IUKCJcwhWN BwVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=q5CAdz3Y+iuyLVwjdqkRPjvFMp65X3VN34is+r7CpEA=; b=OUsWe0tKRfk+cbCvsDf7ufQDHIh+op0X3Va0+WTzaFBO0xYAcf4ql0DFIyMelkqe5q gyNyiRnS0Um24XG4czDonPfZYKWpxW8lrwdiKH/J858mirKq+srxNeNwMcSQc6qFVzke SiC+1Xt4wsex/IWssKrrEoNLHcJYDeC7l4ttl8UUlwmCfb51JyLJEeHMO8nXBURIILQ3 s5Uf5S5TGhMzp0t9qEegImk15Wi2bfBvZqq6AlIt3X1QElBC+MsaVYpEiPlVH6f2pP1r cZFDDvBYATRipGS1a8qb6c6IAomr+UR8hsYSGvdUCpsWuPj+yI9HDoUh3IL5ox6FEwh+ C5xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a17090a9b0e00b0024e473fc6bcsi8226171pjp.141.2023.05.06.05.00.40; Sat, 06 May 2023 05:00:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232373AbjEFLwR (ORCPT + 99 others); Sat, 6 May 2023 07:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231899AbjEFLwM (ORCPT ); Sat, 6 May 2023 07:52:12 -0400 X-Greylist: delayed 123 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 06 May 2023 04:52:09 PDT Received: from mx6.didiglobal.com (mx6.didiglobal.com [111.202.70.123]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 241AF559E; Sat, 6 May 2023 04:52:08 -0700 (PDT) Received: from mail.didiglobal.com (unknown [10.79.71.35]) by mx6.didiglobal.com (Maildata Gateway V2.8) with ESMTPS id 4FDF311004C019; Sat, 6 May 2023 19:50:03 +0800 (CST) Received: from localhost.localdomain (10.79.64.102) by ZJY03-ACTMBX-05.didichuxing.com (10.79.71.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Sat, 6 May 2023 19:50:02 +0800 X-MD-Sfrom: chengkaitao@didiglobal.com X-MD-SrcIP: 10.79.71.35 From: chengkaitao To: , , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , chengkaitao Subject: [PATCH v3 0/2] memcontrol: support cgroup level OOM protection Date: Sat, 6 May 2023 19:49:46 +0800 Message-ID: <20230506114948.6862-1-chengkaitao@didiglobal.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.79.64.102] X-ClientProxiedBy: ZJY01-PUBMBX-01.didichuxing.com (10.79.64.32) To ZJY03-ACTMBX-05.didichuxing.com (10.79.71.35) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Establish a new OOM score algorithm, supports the cgroup level OOM protection mechanism. When an global/memcg oom event occurs, we treat all processes in the cgroup as a whole, and OOM killers need to select the process to kill based on the protection quota of the cgroup Changelog: v3: * Add "auto" option for memory.oom.protect. (patch 1) * Fix division errors. (patch 1) * Add observation indicator oom_kill_inherit. (patch 2) v2: * Modify the formula of the process request memcg protection quota. https://lore.kernel.org/linux-mm/20221208034644.3077-1-chengkaitao@didiglobal.com/ v1: https://lore.kernel.org/linux-mm/20221130070158.44221-1-chengkaitao@didiglobal.com/ chengkaitao (2): mm: memcontrol: protect the memory in cgroup from being oom killed memcg: add oom_kill_inherit event indicator Documentation/admin-guide/cgroup-v2.rst | 29 ++++- fs/proc/base.c | 17 ++- include/linux/memcontrol.h | 46 +++++++- include/linux/oom.h | 3 +- include/linux/page_counter.h | 6 + mm/memcontrol.c | 199 ++++++++++++++++++++++++++++++++ mm/oom_kill.c | 25 ++-- mm/page_counter.c | 30 +++++ 8 files changed, 334 insertions(+), 21 deletions(-) -- 2.14.1