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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 87672C433EF for ; Fri, 3 Sep 2021 07:49:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 21320610A2 for ; Fri, 3 Sep 2021 07:49:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 21320610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 93ED98D0002; Fri, 3 Sep 2021 03:49:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8EF258D0001; Fri, 3 Sep 2021 03:49:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B68D8D0002; Fri, 3 Sep 2021 03:49:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id 686A48D0001 for ; Fri, 3 Sep 2021 03:49:53 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 200BB1DAE7 for ; Fri, 3 Sep 2021 07:49:53 +0000 (UTC) X-FDA: 78545488266.38.31C9357 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf23.hostedemail.com (Postfix) with ESMTP id A607C90000A6 for ; Fri, 3 Sep 2021 07:49:52 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 705962248C; Fri, 3 Sep 2021 07:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1630655391; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NBV68o6W11adCnQjCz2zAGQ8TYTKxVH5j7R83gTy6LY=; b=gppXaYNxMCM4jRCFUJ+Ofe/DSMhM46QMsnlS3Jm9GZk4sXFX1LihMw6t3Usg/oQydX+Mkn xLk87JN4tecJ6GTJlqBRUapceTbdf43ixYsaeCpO0KVl9SjCXoZAAtlzWRZPzAKxW/WEFt BFyaBYQzoVg8aBaja0TFtTu8IY272dY= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 109DFA3B97; Fri, 3 Sep 2021 07:49:51 +0000 (UTC) Date: Fri, 3 Sep 2021 09:49:50 +0200 From: Michal Hocko To: Andrew Morton Cc: cminyard@mvista.com, minyard@acm.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] oom_kill: oom_score_adj broken for processes with small memory usage Message-ID: References: <20210701125430.836308-1-minyard@acm.org> <20210716122547.GI3431@minyard.net> <20210902125501.c83101f27f1a02c58188e3f3@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210902125501.c83101f27f1a02c58188e3f3@linux-foundation.org> X-Rspamd-Queue-Id: A607C90000A6 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=gppXaYNx; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf23.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Rspamd-Server: rspam01 X-Stat-Signature: abobo4k3ckat7cun9dms9w37satuq8km X-HE-Tag: 1630655392-71266 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: On Thu 02-09-21 12:55:01, Andrew Morton wrote: > On Fri, 16 Jul 2021 07:25:47 -0500 Corey Minyard wrote: > > > On Fri, Jul 16, 2021 at 07:19:24AM +0200, Michal Hocko wrote: > > > On Thu 01-07-21 07:54:30, minyard@acm.org wrote: > > > > From: Corey Minyard > > > > > > > > If you have a process with less than 1000 totalpages, the calculation: > > > > > > > > adj = (long)p->signal->oom_score_adj; > > > > ... > > > > adj *= totalpages / 1000; > > > > > > > > will always result in adj being zero no matter what oom_score_adj is, > > > > which could result in the wrong process being picked for killing. > > > > > > > > Fix by adding 1000 to totalpages before dividing. > > > > > > Yes, this is a known limitation of the oom_score_adj and its scale. > > > Is this a practical problem to be solved though? I mean 0-1000 pages is > > > not really that much different from imprecision at a larger scale where > > > tasks are effectively considered equal. > > > > Known limitation? Is this documented? I couldn't find anything that > > said "oom_score_adj doesn't work at all with programs with <1000 pages > > besides setting the value to -1000". > > > > > > > > I have to say I do not really like the proposed workaround. It doesn't > > > really solve the problem yet it adds another special case. > > > > The problem is that if you have a small program, there is no way to > > set it's priority besides completely disablling the OOM killer for > > it. > > > > I don't understand the special case comment. How is this adding a > > special case? This patch removes a special case. Small programs > > working different than big programs is a special case. Making them all > > work the same is removing an element of surprise from someone expecting > > things to work as documented. > > > > Can we please get this resolved one way or the other? As I've already said, I do not see this practical enough problem to warrant special treatment. Do we really care about controlling the oom behavior for tasks with <4MB of memory? I fully agree that the current situation is not ideal. The whole oom_score* API sucks but here we are with an user API that is effectivelly impossible to fix properly. -- Michal Hocko SUSE Labs