From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C15E8C10F00 for ; Mon, 25 Feb 2019 21:28:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 900CE2146F for ; Mon, 25 Feb 2019 21:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551130119; bh=VTyeuAR0lwYM/77DzHXupiJSFPQ2SYI8AhOsy6cHLhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=a8CDowM73z92DAVW0ANZ88zHSblx8PHxwKW2kaHF/7H/xLb54iX5OgvOSXKrqUglq BLyJbcPpp3DoHhPEfxpfmJO6r6A/bD3g2Tkgh2nmB1eM7nP6ah7l3PQjcA1YsAffVr 3yQNG2v0CWyRCOzJ8spdEo1323AJ1kW3tRynuIKs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731874AbfBYV2h (ORCPT ); Mon, 25 Feb 2019 16:28:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:34158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731845AbfBYV2V (ORCPT ); Mon, 25 Feb 2019 16:28:21 -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 9966E2084D; Mon, 25 Feb 2019 21:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551130101; bh=VTyeuAR0lwYM/77DzHXupiJSFPQ2SYI8AhOsy6cHLhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KfA3qYo+mgLINeOXjGytuEqgG3w4FdpzC+i8aipp99294fHjlSG3YTTgB71CP5L3J O49Xy9Qb/9aZXA9xBR8R9zlljgsdE2HdyGqiEWJpY329xBK3dFsjigeix7CNt01vj2 pC/2QxbntY84RR7c/7JPGRINvTOwnuUkIfruxGYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Hocko , Tetsuo Handa , Johannes Weiner , David Rientjes , Yong-Taek Lee , Andrew Morton , Linus Torvalds Subject: [PATCH 4.20 015/183] proc, oom: do not report alien mms when setting oom_score_adj Date: Mon, 25 Feb 2019 22:09:48 +0100 Message-Id: <20190225195057.267332506@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225195054.748060397@linuxfoundation.org> References: <20190225195054.748060397@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 b2b469939e93458753cfbf8282ad52636495965e upstream. Tetsuo has reported that creating a thousands of processes sharing MM without SIGHAND (aka alien threads) and setting /proc//oom_score_adj will swamp the kernel log and takes ages [1] to finish. This is especially worrisome that all that printing is done under RCU lock and this can potentially trigger RCU stall or softlockup detector. The primary reason for the printk was to catch potential users who might depend on the behavior prior to 44a70adec910 ("mm, oom_adj: make sure processes sharing mm have same view of oom_score_adj") but after more than 2 years without a single report I guess it is safe to simply remove the printk altogether. The next step should be moving oom_score_adj over to the mm struct and remove all the tasks crawling as suggested by [2] [1] http://lkml.kernel.org/r/97fce864-6f75-bca5-14bc-12c9f890e740@i-love.sakura.ne.jp [2] http://lkml.kernel.org/r/20190117155159.GA4087@dhcp22.suse.cz Link: http://lkml.kernel.org/r/20190212102129.26288-1-mhocko@kernel.org Signed-off-by: Michal Hocko Reported-by: Tetsuo Handa Acked-by: Johannes Weiner Cc: David Rientjes Cc: Yong-Taek Lee Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/proc/base.c | 4 ---- 1 file changed, 4 deletions(-) --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1084,10 +1084,6 @@ static int __set_oom_adj(struct file *fi task_lock(p); if (!p->vfork_done && process_shares_mm(p, mm)) { - pr_info("updating oom_score_adj for %d (%s) from %d to %d because it shares mm with %d (%s). Report if this is unexpected.\n", - task_pid_nr(p), p->comm, - p->signal->oom_score_adj, oom_adj, - task_pid_nr(task), task->comm); p->signal->oom_score_adj = oom_adj; if (!legacy && has_capability_noaudit(current, CAP_SYS_RESOURCE)) p->signal->oom_score_adj_min = (short)oom_adj;