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=-8.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS 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 7E1E0C433EF for ; Thu, 2 Sep 2021 19:55:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E130561157 for ; Thu, 2 Sep 2021 19:55:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E130561157 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 13BAB8D0001; Thu, 2 Sep 2021 15:55:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EBEF6B0072; Thu, 2 Sep 2021 15:55:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 000E28D0001; Thu, 2 Sep 2021 15:55:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id E41D96B0071 for ; Thu, 2 Sep 2021 15:55:03 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 96C1C82CDEA9 for ; Thu, 2 Sep 2021 19:55:03 +0000 (UTC) X-FDA: 78543686886.38.11AA530 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf17.hostedemail.com (Postfix) with ESMTP id 2B309F0003A0 for ; Thu, 2 Sep 2021 19:55:03 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 0D3AB610E6; Thu, 2 Sep 2021 19:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1630612502; bh=u1LDk6LXB1cLhxmqq/ctqJJhBVTlHtBjyCz5pir16ls=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=B3fZwAuXRu1ZLFQygZRdiRTy9Dq4BQw+RoOwktrTqff5Mf7qBngPCh8Neh97LWM8V WPOTOLDckDj3hZvXBmlI5iBwEkXM88U6zKe3FL8D0N+69bldLif7a2Mxd0Ph/1Tq2w jWbNS5Gl3Hh2HrpKqasiaq2awVGc73Df/y/6aUjE= Date: Thu, 2 Sep 2021 12:55:01 -0700 From: Andrew Morton To: cminyard@mvista.com Cc: Michal Hocko , 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: <20210902125501.c83101f27f1a02c58188e3f3@linux-foundation.org> In-Reply-To: <20210716122547.GI3431@minyard.net> References: <20210701125430.836308-1-minyard@acm.org> <20210716122547.GI3431@minyard.net> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=B3fZwAuX; dmarc=none; spf=pass (imf17.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 2B309F0003A0 X-Stat-Signature: mhcpdjey5rxdh7w5izwkmg13txuku5dm X-HE-Tag: 1630612503-987296 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 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?