From patchwork Thu Aug 2 00:32: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: 10553149 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 4D0BB13B8 for ; Thu, 2 Aug 2018 00:32:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E46B28826 for ; Thu, 2 Aug 2018 00:32:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31F3129A6F; Thu, 2 Aug 2018 00:32:52 +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 5B1A828826 for ; Thu, 2 Aug 2018 00:32:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD74B6B000C; Wed, 1 Aug 2018 20:32:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D876E6B000E; Wed, 1 Aug 2018 20:32:45 -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 C4FE86B0010; Wed, 1 Aug 2018 20:32:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 4B5A46B000C for ; Wed, 1 Aug 2018 20:32:45 -0400 (EDT) Received: by mail-ed1-f70.google.com with SMTP id s18-v6so231382edr.15 for ; Wed, 01 Aug 2018 17:32:45 -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=U3IAqHuTQI5+fGwBjPHzcpkTcIvEn3WUFGPMfJBQWoY=; b=qEUdtKLre7q4fLyZgYScosa6ZabuMRwxa9zamikSiaGdm+43Yh+gJSI1F0oXpUFKV7 t0qSRHnKS9UU7itMcsexfIpYKS8mWFaPTUd+gZP9U9dVyFumQ+GBKinWcJAVvKOKO2/f u2ZzPQJtGD4ZfWUlIXrjKzgoV77IUaoQ9wMzLzysYRmbl2nVlHQXXR65SilD8A5mwb50 jy2TtK2/8ShOTMr62gJrMe/HCksOMcl8G3Aj2SAbTKzsCig8Ga1v4/J8kbQyjccRk/zw 8xwuJlsLMhI05ftZgSz1VxSGRezJYJ2X7twQartNTUGCsqRYzs9S69KgN35YlfCTsC4Y VchA== X-Gm-Message-State: AOUpUlHjCugIY/FSs8iNU8nJeeD3YoymIZp3twGepcNQ9qTyc/IQ809+ /wW5Oxf/L88mRoiC2a5yh2ecgZs5xuIATZsz75oriXGt10cjRIsSbb0BxhNDzU3cvkJb/eHJ4Ru jUzSjLe8kPhWTykl2LaKybytKX0+lpNBTEmg2eQp0cMbyqIwQL+RGvb/muz4suyJyVw== X-Received: by 2002:a50:9943:: with SMTP id l3-v6mr869492edb.272.1533169964689; Wed, 01 Aug 2018 17:32:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfsXMybVOq/18DcgIi76hEFxLgx+3DkjYMZiERK1pMlZq18jCKC4aqrB626R2u+kcc1up98 X-Received: by 2002:a50:9943:: with SMTP id l3-v6mr869466edb.272.1533169963999; Wed, 01 Aug 2018 17:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533169963; cv=none; d=google.com; s=arc-20160816; b=ddabVAc6MrgXJWPLQeOEG19Wt1BDn4Zd2TG7onqt9pnXbjOx4nakh3Znkxr27TBcyq 4JoEjFA6xHFhc/4ZN4uYyOHNDOJ3t6mWsdJOWoFUQaNbH3wd1wjJRwmcvClErIiZJd5h +C92h63/5jGZXX0Cqj2LUf49KTcidm63RmGLfBrbvafwCfzEgQo2jZwltvPvMFbuMbSz yfzaFMmI5+WPyNX1AJYM1IXAQK14zOkksb5ukEwHiMTBZ6qMhGqHOi4dUemvCVGs8x1A sGMqPU+uDbE/Ha/jOpIqjcuH9FcLA3x+3PdZtlZJZQ2uNmhn6Te0FcKDTH/+L8H8Cu/y NXug== 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=U3IAqHuTQI5+fGwBjPHzcpkTcIvEn3WUFGPMfJBQWoY=; b=Gh/aOQVqMfczky1uqHEdPWGlcGA2wR//HEIWC2cjSEWaqzlz+nLELVoWBqGVt+mz/O 46DyF9Sdepmk+9oCCXey0EdgNe3ajZbHoAuSFR3puOmiXScIwZD1CfMm5m2uJ8FUKjzZ ocy9LUFrRKCX51RgUZi3h9Dyn5ADmSZmY9cyHDVWmNlRpNHeR7vNN33ipFxbsLi7iA7V NlWJAVFo8BBzC4YGITX9Fts2dAfgwJCZgY8dDcFlMsjjR3F8H7uBd43Y+AO6BZT8OcJb zsJa3JkIwAxrVuhNVCgvQuy5JDqkuR6sIaglg6N6pUPXzs78IfzYOtEtrNji0NkPK4WR Y76A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=DTaCxZXM; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=EHsgPVsb; spf=pass (google.com: domain of prvs=17527a5e5a=guro@fb.com designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=17527a5e5a=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com. [67.231.153.30]) by mx.google.com with ESMTPS id v2-v6si700600edm.144.2018.08.01.17.32.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 17:32:43 -0700 (PDT) Received-SPF: pass (google.com: domain of prvs=17527a5e5a=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=DTaCxZXM; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=EHsgPVsb; spf=pass (google.com: domain of prvs=17527a5e5a=guro@fb.com designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=17527a5e5a=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w720RlmF031549; Wed, 1 Aug 2018 17:32:33 -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=U3IAqHuTQI5+fGwBjPHzcpkTcIvEn3WUFGPMfJBQWoY=; b=DTaCxZXMCetWwQyJgWZNeSRRI6gUPcaT/N2bYQ82Keu41tKXcXOpX4ljyhE3e55AC6SC y0oMYvjqK+8qPQMYb7TQPiCN6z5YWEbQ6ATLTNTI0sVQZ6/h0i27iT8wIOIibFrQa/yn W83r4qy3r0l4wH0tbdVTnN3cLC/syRADM5Q= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2kknssr7sp-2 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 01 Aug 2018 17:32:33 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.17) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 1 Aug 2018 17:32:29 -0700 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=U3IAqHuTQI5+fGwBjPHzcpkTcIvEn3WUFGPMfJBQWoY=; b=EHsgPVsbY3ThwFrL3ZiOQdeX8xC0mRDjEWq/nxbWHISmgYAGxHp0ZzzIVMqitVxHhe57tdFEUJbmIksUDtpNA9tKoWkh3smKlswTyqdpKMI31iVB9vJisnuEdqz9k3QmNTpTLH/HRV/xoF0R+uMTDublclhNd3QZBnktL6eRi0k= Received: from castle.thefacebook.com (2620:10d:c090:200::5:2fa7) by BY2PR15MB0167.namprd15.prod.outlook.com (2a01:111:e400:58e0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.19; Thu, 2 Aug 2018 00:32:22 +0000 From: Roman Gushchin To: CC: Michal Hocko , Johannes Weiner , David Rientjes , Tetsuo Handa , Tejun Heo , , , Roman Gushchin , Vladimir Davydov , Michal Hocko , Andrew Morton Subject: [PATCH v2 2/3] mm, oom: refactor oom_kill_process() Date: Wed, 1 Aug 2018 17:32:00 -0700 Message-ID: <20180802003201.817-3-guro@fb.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180802003201.817-1-guro@fb.com> References: <20180802003201.817-1-guro@fb.com> MIME-Version: 1.0 X-Originating-IP: [2620:10d:c090:200::5:2fa7] X-ClientProxiedBy: MWHPR13CA0006.namprd13.prod.outlook.com (2603:10b6:300:16::16) To BY2PR15MB0167.namprd15.prod.outlook.com (2a01:111:e400:58e0::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9348a694-726a-4afe-f8e0-08d5f80f6a8c X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:BY2PR15MB0167; X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0167;3:RD1BNDJnTcFkgMwPv1JOu457LVZhQ3QvZXiWaYNoNMnXlj70TWlKk8/hYF3dCM11irznJutDQbwDmF/pcSW+2ZPxxIppVOLHtGQabNqbyJ2zXgWJI0yvQ4AgE3ecil2HdArTS9Pos+RAaksS0UhrhB3JYnVyEk5faJaxr2iNadkE3rfDM5URDkLozXBVMroNGl85QAmIhoix60v6qxG4XoSWlioUUZlArJ0AD23KScBRkWvb4RZQ81zl7WRXz3//;25:ij8N2cB//IS/OWATYa5067apxqGWDrYiY9KivMIvuK747zpwB+Zq7h0nXGHQ8+le7hj2hvZ5Q+ABkSfQ28p52mul+WQHBkfNyMDbMITzxVxC+1Jm0AnEZYiawJxPu9Yhmy00XYFLhD+zGrEOZpxuCF/bHJJKDT7ssOSduh0S538sW5lUZO6R/vK/0dtpDuyj2yoVDo98CGiezVSKXJpfe8bMcCuR81lEqEw6vWVspok8CiPVgub1o394TtNIFSnfnBD2XsjXQzsK1lS4TA9Mx1eg2RvX10UP/iYlAhmtS8j5ZHoduEGtEDZjrx3XciTk6lGD+z0l4JjQIPY6JzCCMA==;31:ah0Y/wEkPVja7wyvy3pihV9mYxa29Vr31Xkq2UImF/D9DLM5kuVUW9V5wC0lQfi0PZk6BSW4Zqd+U+5ICOpXtqEK17raEukkeHxsI3LeAZRa5m2IWhQyVe8c5owhTl0XgisGeArZfTvp0a9prshgn1CoKnAuN9YSsKf3M/M8yBOrdIB+f+prqVRaQldBCs1b1yi6t10phWvrR8IYlk3OAjRHsQho7YgiuZfHSXXF1X8= X-MS-TrafficTypeDiagnostic: BY2PR15MB0167: X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0167;20:KJuJJI1ObBakii0s0y2XJHsiSIDmhYE4n6pgvL22tjEaRRH6qq1ZIyifBV4P6V17yQgk9eBZGcyMvvxC8L0x7V0+MQWtqzEcD0187zXUdHPajSK59AG8MEUwqjg//1hi1kRsy268OwqQ+hhQgEUbXf96ZEIUglvCxj7yiRAwkoiQrCSmm28uRFQyB8So73+kt+pdSqT6dUUJvyANWO7CG527zjZvf5JBL4vq6SyNjy+vV0pzYW5e9mdwSjdEnH424fBKGenzNG1C4uI+lMezjysPGlkYyuwKQUFmDShD72j2cG5kRj4DvP/IX36gCfEtIuiY8TXxtQ37Ye+FqmOpSP1HMVcLjFkOb2EooCjxxK/T3Wt5YfXzKZX2ijROCDhiaFaw3GQPG+Aa4MZj1Ed858NG8eJnnTm3YLx9ROj5lGbx1LMLr67zBz0pBiOz4HLdjwDWepjJM+VnvJKrred6ULllsJnqVpzMve9m3wiDQIONHcHa06r3ORbS+FreeYtE X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(274141268393343)(85827821059158)(67672495146484)(211936372134217)(42068640409301)(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)(3002001)(10201501046)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:BY2PR15MB0167;BCL:0;PCL:0;RULEID:;SRVR:BY2PR15MB0167; X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0167;4:j2OabNnVdGG4l5qwM81A8MBJFQ/HxvZ1prLZKebx77X02H5JAGArYP0PkcquYeEvxy3D+HFW4rNyrgVKH5S8FVLVQY/jmjOqK05gB5DeS0i7oBF271AYXbc2+1L4BX8rnMoRKpzslFgDrSI3fYwE7VVIm9P6saDLkYfWw2Dd4QjS9xQ2q1+VAeYGFOjVbmbrJfHD5ebf/1VkGweJepVmTDwdA/v5xFCb/NC+Z5+O9SaVLr4XjW/aZzVypl6GQ/PGyK7OvCdSs+mCaeP/EWgjJ6dPiiiJQ4CBtMkdNMoNCAyhTxN91qW0ACv1b2+J5lZ2YFXmpltkOSV14DN1cT1l0Lz8095G3VEmTj4NtvozkWOcdECnbnvf7du2IR+K1EH8LVg1aGLVK+4sU4/6xSoMyAXXuACg5zLc4dh92M0UNR/2LxPpzK+3+oPptUowmTwkaAPxVbJF4/QWRFkQj2TwL6IGwm8VxZiCbokeoRr1eGA= X-Forefront-PRVS: 07521929C1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(39860400002)(366004)(376002)(346002)(136003)(396003)(189003)(199004)(25786009)(52116002)(54906003)(36756003)(68736007)(16586007)(50226002)(316002)(6306002)(53936002)(39060400002)(51416003)(76176011)(6486002)(6512007)(50466002)(52396003)(966005)(7416002)(5660300001)(6506007)(386003)(4326008)(16526019)(478600001)(2361001)(186003)(6916009)(1076002)(305945005)(8676002)(476003)(6116002)(11346002)(486006)(2351001)(6666003)(7736002)(97736004)(8936002)(48376002)(446003)(2906002)(53416004)(86362001)(46003)(47776003)(69596002)(14444005)(106356001)(81156014)(81166006)(2616005)(105586002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR15MB0167;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;BY2PR15MB0167;23:eEMcX77e5JcmKzhVviUUnm35ejlcDqSHxWRuMiZuI5F5O8EAGZjEx/gljNzwQQ6Aa66Hx3ClXV0deH48fZfpDHHSHUkz1Sgnopg83VMhoBz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q0yz1dH0Q42UJrzMA6OB2Kg==;5:QAYBiNp0ivOOgikKFf3Q8XiRhK8gz8t1AsriO4U3s4kYVIYUA7IuVR9DvA5+/OLUZEQkhjjKW6vg2wovf5spjhGQthkkKshT7t9kjbS7Q4Kw0kkqjC7AepDr+H6kx1+WezZprVY5Bh1/ph+sCVafVD2+8+YrTpYr4pXSL71TWzc=;7:o883EyR/KsExRU16RBSyYmJOgDNuHeWZcLQ7FYpfuL+nlxuzO52d8K18oEV+7TIWqif7nj/D11AEhoVlQx4n5VQkpanUMQ4AvvZX4Oj0sJj1X1gOyNrN1+DDctumUs5ZorPxXiHEx2y78AKdpPSCRwyY0x6lzMePYWg0SwX0ZpFqoy+k3297WxcSG3vxTyU5oIordWOy7R+rEUCZmkb9m5ZJPR7fqbHE+6UlCfzwI6CUJ2u65QdeobCpnta1smI6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0167;20:FUhSzAf0sGyThyPPzAnJ/hFW/2oUYn2GMqsLv13tp0LdUBvhAfaWr5aJNuKRgtpHItf2if5lUhfUC8NY0SGqaX/oIRakIHEXU6hbNSIw0pgQiVbzRfFTLwx+Px7cmelHg4lqVwD2zN2LXO0j7MveitPFqozhjri9qLGNM2xVk58= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2018 00:32:22.7474 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9348a694-726a-4afe-f8e0-08d5f80f6a8c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR15MB0167 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-01_09:,, 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 oom_kill_process() consists of two logical parts: the first one is responsible for considering task's children as a potential victim and printing the debug information. The second half is responsible for sending SIGKILL to all tasks sharing the mm struct with the given victim. This commit splits oom_kill_process() with an intention to re-use the the second half: __oom_kill_process(). The cgroup-aware OOM killer will kill multiple tasks belonging to the victim cgroup. We don't need to print the debug information for the each task, as well as play with task selection (considering task's children), so we can't use the existing oom_kill_process(). Link: http://lkml.kernel.org/r/20171130152824.1591-2-guro@fb.com Signed-off-by: Roman Gushchin Acked-by: Michal Hocko Acked-by: Johannes Weiner Acked-by: David Rientjes Cc: Vladimir Davydov Cc: Tetsuo Handa Cc: David Rientjes Cc: Tejun Heo Cc: Michal Hocko Signed-off-by: Andrew Morton --- mm/oom_kill.c | 123 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 65 insertions(+), 58 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 84081e77bc51..8bded6b3205b 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -835,68 +835,12 @@ static bool task_will_free_mem(struct task_struct *task) return ret; } -static void oom_kill_process(struct oom_control *oc, const char *message) +static void __oom_kill_process(struct task_struct *victim) { - struct task_struct *p = oc->chosen; - unsigned int points = oc->chosen_points; - struct task_struct *victim = p; - struct task_struct *child; - struct task_struct *t; + struct task_struct *p; struct mm_struct *mm; - unsigned int victim_points = 0; - static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL, - DEFAULT_RATELIMIT_BURST); bool can_oom_reap = true; - /* - * If the task is already exiting, don't alarm the sysadmin or kill - * its children or threads, just give it access to memory reserves - * so it can die quickly - */ - task_lock(p); - if (task_will_free_mem(p)) { - mark_oom_victim(p); - wake_oom_reaper(p); - task_unlock(p); - put_task_struct(p); - return; - } - task_unlock(p); - - if (__ratelimit(&oom_rs)) - dump_header(oc, p); - - pr_err("%s: Kill process %d (%s) score %u or sacrifice child\n", - message, task_pid_nr(p), p->comm, points); - - /* - * If any of p's children has a different mm and is eligible for kill, - * the one with the highest oom_badness() score is sacrificed for its - * parent. This attempts to lose the minimal amount of work done while - * still freeing memory. - */ - read_lock(&tasklist_lock); - for_each_thread(p, t) { - list_for_each_entry(child, &t->children, sibling) { - unsigned int child_points; - - if (process_shares_mm(child, p->mm)) - continue; - /* - * oom_badness() returns 0 if the thread is unkillable - */ - child_points = oom_badness(child, - oc->memcg, oc->nodemask, oc->totalpages); - if (child_points > victim_points) { - put_task_struct(victim); - victim = child; - victim_points = child_points; - get_task_struct(victim); - } - } - } - read_unlock(&tasklist_lock); - p = find_lock_task_mm(victim); if (!p) { put_task_struct(victim); @@ -970,6 +914,69 @@ static void oom_kill_process(struct oom_control *oc, const char *message) } #undef K +static void oom_kill_process(struct oom_control *oc, const char *message) +{ + struct task_struct *p = oc->chosen; + unsigned int points = oc->chosen_points; + struct task_struct *victim = p; + struct task_struct *child; + struct task_struct *t; + unsigned int victim_points = 0; + static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST); + + /* + * If the task is already exiting, don't alarm the sysadmin or kill + * its children or threads, just give it access to memory reserves + * so it can die quickly + */ + task_lock(p); + if (task_will_free_mem(p)) { + mark_oom_victim(p); + wake_oom_reaper(p); + task_unlock(p); + put_task_struct(p); + return; + } + task_unlock(p); + + if (__ratelimit(&oom_rs)) + dump_header(oc, p); + + pr_err("%s: Kill process %d (%s) score %u or sacrifice child\n", + message, task_pid_nr(p), p->comm, points); + + /* + * If any of p's children has a different mm and is eligible for kill, + * the one with the highest oom_badness() score is sacrificed for its + * parent. This attempts to lose the minimal amount of work done while + * still freeing memory. + */ + read_lock(&tasklist_lock); + for_each_thread(p, t) { + list_for_each_entry(child, &t->children, sibling) { + unsigned int child_points; + + if (process_shares_mm(child, p->mm)) + continue; + /* + * oom_badness() returns 0 if the thread is unkillable + */ + child_points = oom_badness(child, + oc->memcg, oc->nodemask, oc->totalpages); + if (child_points > victim_points) { + put_task_struct(victim); + victim = child; + victim_points = child_points; + get_task_struct(victim); + } + } + } + read_unlock(&tasklist_lock); + + __oom_kill_process(victim); +} + /* * Determines whether the kernel must panic because of the panic_on_oom sysctl. */