From patchwork Mon Jul 30 18:01:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 10549551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 365E315E2 for ; Mon, 30 Jul 2018 18:01:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 261582A419 for ; Mon, 30 Jul 2018 18:01:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19E712A5FD; Mon, 30 Jul 2018 18:01:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2357D2A419 for ; Mon, 30 Jul 2018 18:01:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B38A6B026A; Mon, 30 Jul 2018 14:01:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 73CE56B026B; Mon, 30 Jul 2018 14:01:52 -0400 (EDT) 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 591196B026C; Mon, 30 Jul 2018 14:01:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id BA5D76B026A for ; Mon, 30 Jul 2018 14:01:51 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id s18-v6so2658720edr.15 for ; Mon, 30 Jul 2018 11:01:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:dkim-signature:from:to:cc:subject :date:message-id:in-reply-to:references:mime-version :spamdiagnosticoutput:spamdiagnosticmetadata; bh=jjQDxH19kVIiM6W25t2mvZ6lYn+GWixHhSdAj2O35o0=; b=GEQlWRGjVxGneNvbY8aLOndCLRPKvI1dn/VsKAuYzihuAm76ksP1LJMkm1m6iKcMAg SWKIpXDJVRh6jouwTvH3wX4CkI2iPabNtvAprTD4d2xC/Ivz1hVZWFgE8EOpQeXzvZKo BMthw4lHrVGvs6b0TcqQTHISm+PsldzF49hjDRa6GEpYaRXRG2Jeq0lE8ce8HiFOw74+ gGaj/9VbXDuON4ajk8lnw6ToK2VxpYeUTHMJxlE+BiS1BYWo00UPgudhOCrZ1UbP42n5 /L3+lE7dK5dCeYSdlYduWtFJX/jsmwGdVl5HHxk3aOW4Umr4OIikK6r6Ce0pZM4134Kh OMWA== X-Gm-Message-State: AOUpUlFd3+ea3qNbG9qyPaqCo/+kr4G3XRV6aZW60WX97Kd5Hn14TTP2 n+vvQ1Vz5Psjx4VJe6gxxkfJWR4af/P3ZKEvIc6XjSHnpQvSPAFz0HPtHLjVSXRbVuUP1KXaryj byiYeSfO6sgVOONJRqLoE4BmOcQHkDVuNERzK44CZ2PObXn1zLVGnuloh5QdBbocKrA== X-Received: by 2002:a50:b5a5:: with SMTP id a34-v6mr8931740ede.88.1532973711200; Mon, 30 Jul 2018 11:01:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcMYyOj0Wpi1KtgyKx6qyMF83R9gPPGUjM7rIiU9xN9oH9kDOKyUqd9UASlvHo3IF+xIuhH X-Received: by 2002:a50:b5a5:: with SMTP id a34-v6mr8931699ede.88.1532973710408; Mon, 30 Jul 2018 11:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532973710; cv=none; d=google.com; s=arc-20160816; b=YjAGWismXAgxjBQSxnxkV78htC0etKNhrLPLCgHXZygWSJt2Vw3+5vQ2Yhk2yJNj7k +38cBWMILfduGA/MtSEd6nKkVefN+KsQ5o5jqi9DltRoyr0mYPZX1mGmpofnHFxSiasZ jNKoTVQzYp9gzQvVtc9N2xQ/C2HPmbcXjaSMAd6YOlJ8hjs95lu2tMleR1oQGE84q/b+ AXQFPpQkpMHEvl+tgm0G449z4h1tiue/4wUQkZU/On2xO1n3Y7HQrxCe6gjvNfmB+ytt GcLko5SPnDkBxMWzOISHchfj+fAdX5rZCWBPrs2Vp+crjO8/+zcIj1KGrIW891KN9VPM 9rTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-signature:arc-authentication-results; bh=jjQDxH19kVIiM6W25t2mvZ6lYn+GWixHhSdAj2O35o0=; b=ReLhJKs0xwBnyEjuohJnkndFCvBehwS3XfpmjRmYnZjl5PZx5xU10wlGnsCkAgicAq cEW7shJ1NvlG5pt+3uexC0CUMznuC5RHTG7ZGGR9a6fgr7HKdyWWibCQz/O/4bhfzESR Bb4siYZGst//p+MMqENvZcg4I+TH3MPYv/IUMDxdOqC/FWmx/vipXBvnGVBepPzCvQCT GMqr+lH7lx7D6+EfkTxB8vFeFTJK8WlO9GMXBxH57AUKbnDmU/tF3iwklP/qLvvreOh4 l2b5lKgqiGjo5whZYz3DeI2I2maCoOc0/V7RyDjl6kdrwF4rMjdX8znWzPase9tU7Wha +1dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=Ji6nxeAN; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=YSYF4zns; spf=pass (google.com: domain of prvs=17496daedc=guro@fb.com designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=17496daedc=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com. [67.231.153.30]) by mx.google.com with ESMTPS id b15-v6si4944191edm.391.2018.07.30.11.01.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 11:01:50 -0700 (PDT) Received-SPF: pass (google.com: domain of prvs=17496daedc=guro@fb.com designates 67.231.153.30 as permitted sender) client-ip=67.231.153.30; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=Ji6nxeAN; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=YSYF4zns; spf=pass (google.com: domain of prvs=17496daedc=guro@fb.com designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=17496daedc=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6UHpdtS030163; Mon, 30 Jul 2018 11:01:40 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=jjQDxH19kVIiM6W25t2mvZ6lYn+GWixHhSdAj2O35o0=; b=Ji6nxeANwQld9btMYdAobQsibRZfxY6qHjnm9Ufdcq1/eZu1qjOddNGeJ9hGWkVgcfYc /W18QdI79CIH93dKh1D+NTx7mUXywfBQuLR4mOJGknJtanNZSn7dwnIlJ2+MOlRdry7Q CRAohNxbVVUP0cv3suki6+ZAqHeA2UIlIgs= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0b-00082601.pphosted.com with ESMTP id 2kj6yy040v-2 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 30 Jul 2018 11:01:39 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.25) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 30 Jul 2018 14:01:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jjQDxH19kVIiM6W25t2mvZ6lYn+GWixHhSdAj2O35o0=; b=YSYF4znsOJXSuq6eb7RA3Z9R+qDHczs8/3N/oGH2FP3kHmXSDhjlxBuSQS6nM8Xtglteo2kFjaOTBg1UM9D2QD2vHbbpLw0l22CIFuIYqWFLD7eenVfcDyu6wQ6L7GDKjGLV/AqWR/ZBV4AFtBHat2Xzzy9bHIC62/12afdmZAc= Received: from castle.thefacebook.com (2620:10d:c090:200::6:484b) by SN1PR15MB0175.namprd15.prod.outlook.com (2a01:111:e400:58cf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.21; Mon, 30 Jul 2018 18:01:33 +0000 From: Roman Gushchin To: CC: Michal Hocko , Johannes Weiner , David Rientjes , Tetsuo Handa , Tejun Heo , , , Roman Gushchin Subject: [PATCH 3/3] mm, oom: introduce memory.oom.group Date: Mon, 30 Jul 2018 11:01:00 -0700 Message-ID: <20180730180100.25079-4-guro@fb.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180730180100.25079-1-guro@fb.com> References: <20180730180100.25079-1-guro@fb.com> MIME-Version: 1.0 X-Originating-IP: [2620:10d:c090:200::6:484b] X-ClientProxiedBy: MWHPR15CA0060.namprd15.prod.outlook.com (2603:10b6:301:4c::22) To SN1PR15MB0175.namprd15.prod.outlook.com (2a01:111:e400:58cf::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 547c7b7a-b56c-418b-65aa-08d5f6467d74 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:SN1PR15MB0175; X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0175;3:zgufgtInyxTjXDizR5/h+XZLEgl3EU3Pb0uCd4ESW+otWBrKVje91k8pwK+gD2riOagTVbfPVUVSi+WEWbtKH/7ln6OU0ZVu4GvCW/2iyCy/HCi721nfXdxHIslR+N+ojrpG3c9Ttl3xPLxvd04BF8ZxgofYGwt0c7LAkXqfQTNhkyGXdXIt7fVG/ouIBDILxB6Z9W10aN4/foBELOvJe5Py9eEgBV9iJAaUvkoykeaBHqmmzHoRGM+vSlngtVCN;25:I0+w+loOR+hPinGuoYmHtZ3xB5rzrvvzSpI6jng+TWLZ4qEWs9fpHigezXF91D+NTYwRJPVO1FmJmrBIcwBeY4FVEOTnUwzr0tMJVNTcdGbQX1CsaIK72A/cE8L1mzGpnuGKDAOboNhkGwMRKfISQMZEEWyWd7uhFFADz21GtzJ6BgDfrNs4/CnWUVGB41sAKkS3fD4enyUBIRQ1meCwcob5GyScIsj+1vu0S4lO8YQo4cfQJVrMrbavbwWgz9w1fJQ9Ghl9rPgvXaxtKLEMLcTvahPsA71hgXAlbvn9HhfEIQ1BtjDtWp4D6V94YBWVWxcooKHuAmtnJta4HVCwlg==;31:VCn1kUOzk8Lb/9N/uNcF+SnFDjqz0EVng4gQE7ED3Tbjvf8+d14oI3w1s9ozQZj2W8CMU4R0nlvPCCDMZAOGY3QWgQ8xDI+QtnyKDenvVUYBD2wygpDUlAi0Lp8ee0ScngM/eaRAV0C0xmFxt7e1u5qPsAk+qfojKcGKGdDKWacPW2zrd3HXw+EB7XJ+bNcHDgQziYVvEjUG6LT4RqoJv6uPL3wB0b24ij1T1vasqIY= X-MS-TrafficTypeDiagnostic: SN1PR15MB0175: X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0175;20:860WIDtG/UpAZLKw0+6k8sh+bLUBegcQmNM8ougELaVT9j9CjcEE7OGviVlxPwMtpDHa9n0Id5wE4OHYyj7GnYcPmtRLkprFMW835Yu+j6B61+wb5fw2MgcKkpoRMUokmcOqLcbfdCZIAn/d9MWeeSHyrcmCMeZhlqZrAihEQDVmhIIH/gr9Q6FiyIyCSWbIxaDLW8fDHp1JjuFHtdRIJy1xKKTTVhUEG/MNbVwxWlodk8Y080MDa6p/h8LNiyvws/iCQWoSb3u/f8sAXfU/I1lj4ZQA1U9uIS81s0fHkFP14QUAyZUmGRfpP3BLhVgRX64tDcrpuzC2F6nS8AY63N0Zb++zy5YW6qrQQ90EzDE4p/hqAj5j5mHl1Wa25fIEBhkjxZ4GqvliNmfdtTgwzLVR9zUbr/VUldln9U0A372rkt79ZppmaX9LGmyqPzeDgCVZyrb9M7A2LNo43pEacYAz5Nnv2YQsrSlkLilZnnPqV5ngMiZ2qPCuvByjTpfJ;4:Kjowog2MJ/a5HzVF1nIbjZZnoMbE9zdMXMdciyGk4RKmvjT/hwQJ+V5PIiWkA5yiDDO7hrk4wsY2kIacwh8x++QYDzHKquTMSKHC2MkuMfJuR4ePy1BZX/aPHOHovBh7KuUDVNQ7OLmxDGiufgIMy7E37TC2kTpQYVhAgy6BVor2RfWOZj0bhMg43cKQVQTphSonap37HctTGU8vs9WT5I7vUcJJ77jSzm7E3TTMheLssQt40/+BaR+R/BPKpUEYZUoZpGPiWWMa2JMqeC6Th9Fd/EV1eI5WssPf8CGzpG06Ac1wPMhW3A61CHOWCA+0nWcLd0aVRERVX9pC+4ly2Qg8Ag74nyeo13yiz+t4nb3N2J5Yzn8w1Rf1sjDowd8HVqqJizsW9+a3uuwnJt5vGp2VL1Qn5bVHDUN4sZ 6SGZM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(274141268393343)(67672495146484)(211936372134217)(153496737603132); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231311)(11241501184)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:SN1PR15MB0175;BCL:0;PCL:0;RULEID:;SRVR:SN1PR15MB0175; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(396003)(39860400002)(376002)(366004)(136003)(189003)(199004)(57704003)(36756003)(6116002)(8676002)(6486002)(16526019)(6506007)(386003)(186003)(1076002)(86362001)(69596002)(76176011)(52116002)(51416003)(52396003)(81156014)(106356001)(2351001)(105586002)(97736004)(8936002)(81166006)(305945005)(7736002)(53936002)(6666003)(50226002)(25786009)(53416004)(478600001)(6512007)(5660300001)(2906002)(6916009)(14444005)(54906003)(2361001)(16586007)(316002)(11346002)(446003)(48376002)(50466002)(47776003)(476003)(4326008)(46003)(68736007)(2616005)(486006)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR15MB0175;H:castle.thefacebook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0175;23:o4r5UjjHWzzC695YOvuCiEuK8UK7ZY942zzLMKiyu5bHuENhV/VzUrdiue4TBnFW+sPyDsjzo4BYMSVuPHZjJTa8w7+fzozgddgQB7UxEkHTaT2CIg4PAyjiIsM51AjovMwuceX5N5lJ7oX2HwCc5zVlUsXFfwjH3kP+yxmedyFgNMSpBB9c1o3kBqcEwug47vMz0+lpROh2ImeFCNtS8aoDikaldMguUsIuj1gH1IN7M4rLICqD2FWwq/RE5dB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f/5tDRLLSiIZdmyKbABoZiYzuEd+rlcCf8FKgEJ9FtgRPug2u53wrDFZ41h38XQGxCS+c9VuPIfvlSuaFuqmMQS6pSAULRJCsP6W7eCGDpELNteJzlumhb0bT4TFRMx/RwxVNb/dkzzpl9BipWJ2n9/zxr1XJjyRl45thGCs7IzpfoJsbdSwk8DwunHU3bO7M2pdoukEFy0Xqei7G71Pg2IxDCyBQgsgbN/qvoLwWcTSLD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0175;20:13HiqwHM4zJxqVcU5T/02cMpCKodW5WqmYC0nghDV1p96OkU8tYWv0dDE9W4N3WdKXaRPZUEl7NnqHIcIkwHCa1Oxe704SBLVUoM59EtrHwfEjxwdCZUVXUSnBq0sxHKPlS4dmg8uRM2o0TXaii/TRSo1I2k1uPdwX+3Lzp3Hn4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 18:01:33.6401 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 547c7b7a-b56c-418b-65aa-08d5f6467d74 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR15MB0175 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-30_08:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe 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: X-Virus-Scanned: ClamAV using ClamSMTP For some workloads an intervention from the OOM killer can be painful. Killing a random task can bring the workload into an inconsistent state. Historically, there are two common solutions for this problem: 1) enabling panic_on_oom, 2) using a userspace daemon to monitor OOMs and kill all outstanding processes. Both approaches have their downsides: rebooting on each OOM is an obvious waste of capacity, and handling all in userspace is tricky and requires a userspace agent, which will monitor all cgroups for OOMs. In most cases an in-kernel after-OOM cleaning-up mechanism can eliminate the necessity of enabling panic_on_oom. Also, it can simplify the cgroup management for userspace applications. This commit introduces a new knob for cgroup v2 memory controller: memory.oom.group. The knob determines whether the cgroup should be treated as a single unit by the OOM killer. If set, the cgroup and its descendants are killed together or not at all. To determine which cgroup has to be killed, we do traverse the cgroup hierarchy from the victim task's cgroup up to the OOMing cgroup (or root) and looking for the highest-level cgroup with memory.oom.group set. Tasks with the OOM protection (oom_score_adj set to -1000) are treated as an exception and are never killed. This patch doesn't change the OOM victim selection algorithm. Signed-off-by: Roman Gushchin Cc: Michal Hocko Cc: Johannes Weiner Cc: David Rientjes Cc: Tetsuo Handa Cc: Tejun Heo Acked-by: Michal Hocko Acked-by: Johannes Weiner --- Documentation/admin-guide/cgroup-v2.rst | 16 +++++++ include/linux/memcontrol.h | 13 +++++ mm/memcontrol.c | 84 +++++++++++++++++++++++++++++++++ mm/oom_kill.c | 29 ++++++++++++ 4 files changed, 142 insertions(+) diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst index 8a2c52d5c53b..f11de1b78cfc 100644 --- a/Documentation/admin-guide/cgroup-v2.rst +++ b/Documentation/admin-guide/cgroup-v2.rst @@ -1069,6 +1069,22 @@ PAGE_SIZE multiple when read back. high limit is used and monitored properly, this limit's utility is limited to providing the final safety net. + memory.oom.group + A read-write single value file which exists on non-root + cgroups. The default value is "0". + + Determines whether the cgroup should be treated as a single + unit by the OOM killer. If set, the cgroup and its descendants + are killed together or not at all. This can be used to avoid + partial kills to guarantee workload integrity. + + Tasks with the OOM protection (oom_score_adj set to -1000) + are treated as an exception and are never killed. + + If the OOM killer is invoked in a cgroup, it's not going + to kill any tasks outside of this cgroup, regardless + memory.oom.group values of ancestor cgroups. + memory.events A read-only flat-keyed file which exists on non-root cgroups. The following entries are defined. Unless specified diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index e53e00cdbe3f..05c9c867a3ab 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -213,6 +213,11 @@ struct mem_cgroup { */ bool use_hierarchy; + /* + * Should the OOM killer kill all belonging tasks, had it kill one? + */ + bool oom_group; + /* protected by memcg_oom_lock */ bool oom_lock; int under_oom; @@ -517,6 +522,8 @@ static inline bool task_in_memcg_oom(struct task_struct *p) } bool mem_cgroup_oom_synchronize(bool wait); +struct mem_cgroup *mem_cgroup_get_oom_group(struct task_struct *victim, + struct mem_cgroup *oom_domain); #ifdef CONFIG_MEMCG_SWAP extern int do_swap_account; @@ -951,6 +958,12 @@ static inline bool mem_cgroup_oom_synchronize(bool wait) return false; } +static inline struct mem_cgroup *mem_cgroup_get_oom_group( + struct task_struct *victim, struct mem_cgroup *oom_domain) +{ + return NULL; +} + static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, int idx) { diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 8c0280b3143e..ade832571091 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1577,6 +1577,53 @@ bool mem_cgroup_oom_synchronize(bool handle) return true; } +/** + * mem_cgroup_get_oom_group - get a memory cgroup to clean up after OOM + * @victim: task to be killed by the OOM killer + * @oom_domain: memcg in case of memcg OOM, NULL in case of system-wide OOM + * + * Returns a pointer to a memory cgroup, which has to be cleaned up + * by killing all belonging OOM-killable tasks. + */ +struct mem_cgroup *mem_cgroup_get_oom_group(struct task_struct *victim, + struct mem_cgroup *oom_domain) +{ + struct mem_cgroup *oom_group = NULL; + struct mem_cgroup *memcg; + + if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) + return NULL; + + if (!oom_domain) + oom_domain = root_mem_cgroup; + + rcu_read_lock(); + + memcg = mem_cgroup_from_task(victim); + if (!memcg || memcg == root_mem_cgroup) + goto out; + + /* + * Traverse the memory cgroup hierarchy from the victim task's + * cgroup up to the OOMing cgroup (or root) to find the + * highest-level memory cgroup with oom.group set. + */ + for (; memcg; memcg = parent_mem_cgroup(memcg)) { + if (memcg->oom_group) + oom_group = memcg; + + if (memcg == oom_domain) + break; + } + + if (oom_group) + css_get(&oom_group->css); +out: + rcu_read_unlock(); + + return oom_group; +} + /** * lock_page_memcg - lock a page->mem_cgroup binding * @page: the page @@ -5328,6 +5375,37 @@ static int memory_stat_show(struct seq_file *m, void *v) return 0; } +static int memory_oom_group_show(struct seq_file *m, void *v) +{ + struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m)); + + seq_printf(m, "%d\n", memcg->oom_group); + + return 0; +} + +static ssize_t memory_oom_group_write(struct kernfs_open_file *of, + char *buf, size_t nbytes, loff_t off) +{ + struct mem_cgroup *memcg = mem_cgroup_from_css(of_css(of)); + int ret, oom_group; + + buf = strstrip(buf); + if (!buf) + return -EINVAL; + + ret = kstrtoint(buf, 0, &oom_group); + if (ret) + return ret; + + if (oom_group != 0 && oom_group != 1) + return -EINVAL; + + memcg->oom_group = oom_group; + + return nbytes; +} + static struct cftype memory_files[] = { { .name = "current", @@ -5369,6 +5447,12 @@ static struct cftype memory_files[] = { .flags = CFTYPE_NOT_ON_ROOT, .seq_show = memory_stat_show, }, + { + .name = "oom.group", + .flags = CFTYPE_NOT_ON_ROOT | CFTYPE_NS_DELEGATABLE, + .seq_show = memory_oom_group_show, + .write = memory_oom_group_write, + }, { } /* terminate */ }; diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 8bded6b3205b..08f30ed5abed 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -914,6 +914,19 @@ static void __oom_kill_process(struct task_struct *victim) } #undef K +/* + * Kill provided task unless it's secured by setting + * oom_score_adj to OOM_SCORE_ADJ_MIN. + */ +static int oom_kill_memcg_member(struct task_struct *task, void *unused) +{ + if (task->signal->oom_score_adj != OOM_SCORE_ADJ_MIN) { + get_task_struct(task); + __oom_kill_process(task); + } + return 0; +} + static void oom_kill_process(struct oom_control *oc, const char *message) { struct task_struct *p = oc->chosen; @@ -921,6 +934,7 @@ static void oom_kill_process(struct oom_control *oc, const char *message) struct task_struct *victim = p; struct task_struct *child; struct task_struct *t; + struct mem_cgroup *oom_group; unsigned int victim_points = 0; static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); @@ -974,7 +988,22 @@ static void oom_kill_process(struct oom_control *oc, const char *message) } read_unlock(&tasklist_lock); + /* + * Do we need to kill the entire memory cgroup? + * Or even one of the ancestor memory cgroups? + * Check this out before killing the victim task. + */ + oom_group = mem_cgroup_get_oom_group(victim, oc->memcg); + __oom_kill_process(victim); + + /* + * If necessary, kill all tasks in the selected memory cgroup. + */ + if (oom_group) { + mem_cgroup_scan_tasks(oom_group, oom_kill_memcg_member, NULL); + mem_cgroup_put(oom_group); + } } /*