Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp650011imu; Fri, 11 Jan 2019 06:48:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN7xm8i3Rzaz9D63nNqdcmWDfsiMUE8dLviPO/l7YoIdm9BFzU51QnOgOmy5WONKprBH3rOh X-Received: by 2002:a17:902:bc3:: with SMTP id 61mr15001438plr.15.1547218121208; Fri, 11 Jan 2019 06:48:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547218121; cv=none; d=google.com; s=arc-20160816; b=pKfpR5Jvasji8BsHWsQ0zpGFS69VRwK6P5JoKqQPc1gytcEhTUWxzU74MjQsVN9Co7 W60MKYoGf5xx7RUQROZ5NOXO1LiWGIDRPaX+ZBHX+C114qy6lK3T2WnGhnMI66FdnlOb QUbI17esMncF3sGGnxK828qVQnSzN4zzO3CSaFyL7ns4BSa9Y4SN8F+VaE71JZwMIK94 YsAk4lwYmDrNOi5XE501H29/IJ7MwOV2F+hS4i9b+tujNOyQn8hM2yGCEMH8RjhEVlN+ hIXMBP6vFpYP+K80KJ79ieyYne96++UjyydgYjX88Z7zndb+QqCz/WPT8JddAq6+soaj TSDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OmmtF0n0JWdCi4MBsGLd5q6ExQucwb6m1HDRlEjrMp8=; b=VPUbxpVpGbCDXCN6Zmf1v9UHBEevxcD7Cor1GXLoV5sdfoErr4Vs4WmmeU91uDyUIB +QMFSlQ4LEioKToF3A2RhCwb4q0PrG/5AFdxCPQhcd0q3JLhEFp4nPGPrCM4bAzr5p9d Ga0hA7WlbfXBwOJ4aNeJ5zMRh/9s71nwF2PMsWjFi/5YjKeK8QSKz1jK+U/Btti7A08S NGXLzQ9K1RVkt6JE7gTqBzz23p7dSI2evtnIx51bp99lbOiGonFcVpFUbsUVqeeIctdF V+kJwZXd+TQym+u9F3eM4qr5+Q8msUhgNQYUWrsDmF64t5AHtCspYqTMynMAbMUE+H27 1sQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AmW+qn9k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j34si68920674pgj.557.2019.01.11.06.48.25; Fri, 11 Jan 2019 06:48:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AmW+qn9k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404294AbfAKOnC (ORCPT + 99 others); Fri, 11 Jan 2019 09:43:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:35808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404279AbfAKOm7 (ORCPT ); Fri, 11 Jan 2019 09:42:59 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2E2CF206B7; Fri, 11 Jan 2019 14:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547217778; bh=a11V7MEueFQl58GX/ZIQz44G1F9YQSMxxXDGBZ9skk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AmW+qn9kR8Tal6E5ePrsg3bcF6uwhlCdfUQqYLpzc4e0+i0BxSymcNf1B5XA9aA6C iQvo8UdaifJIMd+wN47DlMpYLNJym1rgJjOoisLM1qDqQpNDAgiE0DLn0BWbCJ25/U 3/jo9en/dZ/tMisdrQCIVHoajaeSAS1Q+G9JLrGU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Hocko , Burt Holzman , Johannes Weiner , Andrew Morton , Linus Torvalds Subject: [PATCH 4.20 09/65] memcg, oom: notify on oom killer invocation from the charge path Date: Fri, 11 Jan 2019 15:14:55 +0100 Message-Id: <20190111131057.589328993@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131055.331350141@linuxfoundation.org> References: <20190111131055.331350141@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michal Hocko commit 7056d3a37d2c6aaaab10c13e8e69adc67ec1fc65 upstream. Burt Holzman has noticed that memcg v1 doesn't notify about OOM events via eventfd anymore. The reason is that 29ef680ae7c2 ("memcg, oom: move out_of_memory back to the charge path") has moved the oom handling back to the charge path. While doing so the notification was left behind in mem_cgroup_oom_synchronize. Fix the issue by replicating the oom hierarchy locking and the notification. Link: http://lkml.kernel.org/r/20181224091107.18354-1-mhocko@kernel.org Fixes: 29ef680ae7c2 ("memcg, oom: move out_of_memory back to the charge path") Signed-off-by: Michal Hocko Reported-by: Burt Holzman Acked-by: Johannes Weiner Cc: Vladimir Davydov [4.19+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/memcontrol.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1666,6 +1666,9 @@ enum oom_status { static enum oom_status mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order) { + enum oom_status ret; + bool locked; + if (order > PAGE_ALLOC_COSTLY_ORDER) return OOM_SKIPPED; @@ -1700,10 +1703,23 @@ static enum oom_status mem_cgroup_oom(st return OOM_ASYNC; } + mem_cgroup_mark_under_oom(memcg); + + locked = mem_cgroup_oom_trylock(memcg); + + if (locked) + mem_cgroup_oom_notify(memcg); + + mem_cgroup_unmark_under_oom(memcg); if (mem_cgroup_out_of_memory(memcg, mask, order)) - return OOM_SUCCESS; + ret = OOM_SUCCESS; + else + ret = OOM_FAILED; + + if (locked) + mem_cgroup_oom_unlock(memcg); - return OOM_FAILED; + return ret; } /**