Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp719650pxb; Thu, 2 Sep 2021 13:28:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFCVBbhOKXzWQjHCBRVDHA9GgIWEuASmxPLnQd6NamqlLLcFdDyV5rZqe2gk08sIq8EhqG X-Received: by 2002:a17:906:585a:: with SMTP id h26mr13484ejs.31.1630614512963; Thu, 02 Sep 2021 13:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630614512; cv=none; d=google.com; s=arc-20160816; b=H7U32rcvEvntiNZ+V92eu3YTjBGNTO5ckUSIVP/NOjNDqyebPpll70jG/I73iGz3o0 n30inD41q4F66VQXSHsSOzsiOYVP05xklwWdiVfcFwj9UusAAln5veTQHsF0FoIx6fC0 qUqKo6bYrqltTErRlxNOY6k24Dkg7NmeeLm3Ph2TxtV8B2QA8EycUjkV3QU9Y3jUAqJa SCoBQUYwcfiqtu+84ZZzyM2XdrEmbEgfLiWsvWQ41ZP7WONZ8Q8R6ZGSLApl/UHstuEd qjZW5zh/KPcbvh9knpJrW9Si7MKZKGtG1EklCPOTBznznGfOG8OtyiIokMTaaa25WOSi ShdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ymyhJndSEWTj8CpncOKb9CQWoZub9XIdm60Klb6SFSI=; b=ukHHue/ccCta/COD3wTpuCZnSpEkqyCX/mKAPg9GWSNMBTVknZgfawX/I3poJxJ7j0 ymvQBpOxSjfaV3cgcB5quZUPGbTj16/chhIqHTBBYoZUPjuc7LXbwBPOXNgyKdGAxrmS KpfDPkRyiZAP4wvAVDKDCZiXGD56aNOlWEA/HGpOHIHhoHC5JkHn69EFNFo2J8aeSjjd JTVAWGj1ybwQ/vuSU1a0jqn9LXlVuoC8J5LsEddPka5HnObzqLFZw55RPlSGfh8whtIo KK8pfgFvlnxSj13XJWzZ4BsgXwq9KsB3bRi3MWq/8auAQctXcIiDc83S+nQGKEvMXDaO l22g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=B3fZwAuX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nb8si3170688ejc.529.2021.09.02.13.28.00; Thu, 02 Sep 2021 13:28:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=B3fZwAuX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347447AbhIBT4B (ORCPT + 99 others); Thu, 2 Sep 2021 15:56:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:40304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347444AbhIBT4A (ORCPT ); Thu, 2 Sep 2021 15:56:00 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?