Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753861AbdIDOV5 (ORCPT ); Mon, 4 Sep 2017 10:21:57 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:45299 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753834AbdIDOVw (ORCPT ); Mon, 4 Sep 2017 10:21:52 -0400 From: Roman Gushchin To: CC: Roman Gushchin , Michal Hocko , Vladimir Davydov , Johannes Weiner , Tetsuo Handa , David Rientjes , Andrew Morton , Tejun Heo , , , , Subject: [v7 0/5] cgroup-aware OOM killer Date: Mon, 4 Sep 2017 15:21:03 +0100 Message-ID: <20170904142108.7165-1-guro@fb.com> X-Mailer: git-send-email 2.13.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c092:200::1:6ba5] X-ClientProxiedBy: HE1PR05CA0180.eurprd05.prod.outlook.com (2603:10a6:3:f8::28) To DM3PR15MB1084.namprd15.prod.outlook.com (2603:10b6:0:12::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c87cf43-8829-4d91-c8e4-08d4f3a03f67 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DM3PR15MB1084; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1084;3:s79QsJJJ3JbToiHP8EEuipivfxltMT5CB5T/F1CKNvaZc+3/B1mq2dXzPx4eA/nHb4xuIW3YfH19KbH3mZZ1+AfJXcU0lCKNhUJ8n8WyRCvZVtQFGmc2e5g7FZXU9bL+/ZJ0+c1B4feFyHsV4LG+IQ47AZJe3oBY/yk6eI5MJf0p2fqNTUByi/OSBnL4akeHeMAPE4R97P6+eWQ3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NcsRj1me6cFVMbtB7CoDWq6ZZSHg3g0nHjk98ales2Hab41HK5+oYuiM1L/uaLpm6k4HMvP6zBKgb/7Q/5/N2ZgOygWkiuSTEao0sX1/gY8b1bSGh1p5z1D;4:xCJ3pDUwaTKNkrV5S7XiZxlzZdsp7yxTcmNeNVy9DL+3fYQlydpGk7t9ifMbsw8tNqgE0CxGqCAEKBlOGknmBRVFPJi+jRbS4DfzriZ/KXz+YnAMz12WZ2TUgig5qsl+R8xyWFzWYvN7u+7+BwJb9Drd3MzIPx9potkb3MVIDZj3WqXD0iBOQe4sMFRee+pKGYqoU3TJOc0vrX/dZJdEWxuZJtqvhPOZxGXMZVr8o1KlTfm2J3P86fvcTz77W4RfKsHOvLYG3WuGYwmwblhJ/H4vWoKEn4Lmk8n4tf4yAVmDhCz3CiGP1J8DZw1tedR5n+oUMvnRm6CtbsH0Xr1odJWWwYd2ifAtN8PBkNAxMfSndL7nP0PTRwlCDZJyVTVcC+6fgXvAsOULH4qOTz+icQ== X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(67672495146484)(211936372134217)(153496737603132); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(920507026)(6041248)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM3PR15MB1084;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM3PR15MB1084; X-Forefront-PRVS: 0420213CCD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(189002)(199003)(966005)(86362001)(6666003)(53936002)(1076002)(48376002)(33646002)(50466002)(189998001)(7416002)(69596002)(97736004)(305945005)(6506006)(7736002)(6486002)(5660300001)(6916009)(34040400001)(101416001)(105586002)(6512007)(25786009)(5003940100001)(4326008)(50986999)(81156014)(54906002)(36756003)(53416004)(8936002)(2361001)(81166006)(106356001)(2351001)(42186005)(8676002)(110136004)(47776003)(2906002)(39060400002)(50226002)(478600001)(68736007)(6116002)(6306002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM3PR15MB1084;H:castle.thefacebook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR15MB1084;23:yRQsj68/Zve2vRBzNM9EVeO1M+jDWqhjtmXUKSWFl?= =?us-ascii?Q?cFTMYCDT9/IhCq9MCeBM06Zp78o/9v70rVofLImt02AT4ah+iGVCC/fpRYvX?= =?us-ascii?Q?cyYp+U7sfhzataik7+WtcR8ARr4gwI7X3FQWNO2upD5p5dqgrzQ0DEOdhNoq?= =?us-ascii?Q?YH0glKfS7qxCSafGPgDLjvZzTEf3OcrXlLDkYcm8fAKbNgDz0Vg46EugUNSk?= =?us-ascii?Q?ciUAdSYK1VcVLQqO3jzKjwGjy/QYSAzry1+GcTUoTb/2+24I6ZycAXmX0ngQ?= =?us-ascii?Q?yAiKy6fB3QQ5v3NQQ1yptcPSt5qsRseUeN4ORuFvA4OtE+Ss7ZO1waddjhtu?= =?us-ascii?Q?YPziNwvEI0ZpwMbCeDMJsdmIvB7GIRZROjTbRKvrRfpfDLY4ShiDwKu2wlAT?= =?us-ascii?Q?GY7zlnZCwQE4GRJDKjdbUKQBPPsuiBhoMEhLtFg7z97i4tkHuluPDFEohxJM?= =?us-ascii?Q?FawIl55BoAHrdi1w99xVDb1lisEXWMbgo3UzUAM8XapdCAjiu1UjjL4pMg4o?= =?us-ascii?Q?WokcdZ19bOmCKxPXbD/QweaYVUVyM7H6LhP6mJY/7zkdEGktqLcy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SFzEa3Sg+HQly5wqQaq7R9VaOAJFQX3TdtahJhhyhDcWMu2B+ZkYGXqo8kwWoQbhf3y5rQTf55sUZcnuw==;5:BFFU/FRcxnuUShfYrtosS64FQvmf+b/DHMobgfMB9m5iUy2pYwXWCM/hhnbIlCuownmmRTaFpEd6QIga6nupRRSiJAyub7XrS43KYejp+w3O/F5rYV3E1z+1bxAWjzoLU/AbT/gqXc0qseOqWb4r1A==;24:2sXu1cCa9lHWZ+OTohHVdCcacNpBWWgTPoOt8IP4PcV9YMVy/pUxDtBdgAn2t7TITQZe5QR4qyhrXbp0e6N4+EN6Qs10TnEwfDOVikXtvHs=;7:aNSA/rnMf8dp98vZu1mKNJ5GNeoxsL0RGZEkltQdzKj+aTlb3k9TYMAQVvNjqk0fIcB0sRWvAlcdGzE8CUCwDUihP5oPnfjid46EWwbY7OnJtgnPs++biw40UJnZRdgP0kmejjUbq92HRDikGPy/njpKyvkblz4LhYBgjLCSc7d78fIiaJNcXUMbiXvzaEPtDRDP/tr4is37rTgpw3alyd7MFSpEvcaMMQGN75AnoVk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1084;20:jRoLeBV1mxEavx7kjQOT2kauqUVrfrUNEbkTjmmZH0wZv7DGHfCerYuvEf8XoWWRWnh4WYRIhCXIWJ2N2nvJNqXMVayCYt0U84JVpMB+lEd1qnR4o4NNy3s9OKP1oQ+sJxJytfQyUFXJBH6ZXAiTylwYy4k/uOKsS0fLsiHybHo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2017 14:21:32.1414 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB1084 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-04_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3000 Lines: 85 This patchset makes the OOM killer cgroup-aware. v7: - __oom_kill_process() drops reference to the victim task - oom_score_adj -1000 is always respected - Renamed oom_kill_all to oom_group - Dropped oom_prio range, converted from short to int - Added a cgroup v2 mount option to disable cgroup-aware OOM killer - Docs updated - Rebased on top of mmotm v6: - Renamed oom_control.chosen to oom_control.chosen_task - Renamed oom_kill_all_tasks to oom_kill_all - Per-node NR_SLAB_UNRECLAIMABLE accounting - Several minor fixes and cleanups - Docs updated v5: - Rebased on top of Michal Hocko's patches, which have changed the way how OOM victims becoming an access to the memory reserves. Dropped corresponding part of this patchset - Separated the oom_kill_process() splitting into a standalone commit - Added debug output (suggested by David Rientjes) - Some minor fixes v4: - Reworked per-cgroup oom_score_adj into oom_priority (based on ideas by David Rientjes) - Tasks with oom_score_adj -1000 are never selected if oom_kill_all_tasks is not set - Memcg victim selection code is reworked, and synchronization is based on finding tasks with OOM victim marker, rather then on global counter - Debug output is dropped - Refactored TIF_MEMDIE usage v3: - Merged commits 1-4 into 6 - Separated oom_score_adj logic and debug output into separate commits - Fixed swap accounting v2: - Reworked victim selection based on feedback from Michal Hocko, Vladimir Davydov and Johannes Weiner - "Kill all tasks" is now an opt-in option, by default only one process will be killed - Added per-cgroup oom_score_adj - Refined oom score calculations, suggested by Vladimir Davydov - Converted to a patchset v1: https://lkml.org/lkml/2017/5/18/969 Cc: Michal Hocko Cc: Vladimir Davydov Cc: Johannes Weiner Cc: Tetsuo Handa Cc: David Rientjes Cc: Andrew Morton Cc: Tejun Heo Cc: kernel-team@fb.com Cc: cgroups@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Roman Gushchin (5): mm, oom: refactor the oom_kill_process() function mm, oom: cgroup-aware OOM killer mm, oom: introduce oom_priority for memory cgroups mm, oom, docs: describe the cgroup-aware OOM killer mm, oom: cgroup v2 mount option to disable cgroup-aware OOM killer Documentation/admin-guide/kernel-parameters.txt | 1 + Documentation/cgroup-v2.txt | 56 +++++ include/linux/memcontrol.h | 36 +++ include/linux/oom.h | 12 +- mm/memcontrol.c | 293 ++++++++++++++++++++++++ mm/oom_kill.c | 209 +++++++++++------ 6 files changed, 537 insertions(+), 70 deletions(-) -- 2.13.5