Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1256593pxv; Fri, 16 Jul 2021 05:27:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNQdVB6n/kyd9rSBQC9ojpmf9I+c++yLIdWSLogbOuxTS2+vrF9TISqjTaJnLbgSJmnsIX X-Received: by 2002:a05:6402:27d2:: with SMTP id c18mr14229208ede.261.1626438436497; Fri, 16 Jul 2021 05:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626438436; cv=none; d=google.com; s=arc-20160816; b=QWUFaYV1oSSdz+M5L4eLo92g9GJWuK7CiT3Moj68+5tWnIUB7GNE1cWg0hB38XHCkc JTY+JoZbyPhxl6s7z26TwvgrlP/k4u01Wcy/kUeedhtrA0P72x6ZrILdVDbjS9AXNzGI bpM1MDioLO/kw/qCj0jLnjOUqTo8l/K99E8hGBiM9/nPgNIgeWXQfGZEQkX4NKDRGgsB zbVdhbTff/i0xK/Zc0yc0qb33na78oX0T9PhAPkz8RTOFZRtz/CSIYtF1lZcos8LVLEj ONwQXAD/mIwtuZU4xkAJig08igij0mSvciFs+nsWMCNHbU2jLZ/eJTtfiQ0m85aM1Fib /+1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=jXHUmaf0y4/dZXXr0fZDyHacF0cZd0H8h+cDQdqOEEI=; b=zbZwVDsQxuWqDrQBdw4NEuOwXzCM6vfUA6UVzCcNJFbJd5+LFux1KktvyLc1iziE4x A+coagcp7lgN+jAxf8YLAC5UEWOgMZxwyvi/CVBFposf8WvoUhMkkLwvqQFQfrGUtqVN 3yKDCrpchoDwGzRHpzhKXaR9qmCp/+u9T5RLaI1OUXe2iSLDEhC3gcuSqHOjRSO0BzJW /9F7QtUO0CZfdu8COM6QoVVwA0hGkP6pQH3BmhJLuv9ECq2g4aYyx19NV4wBadQE1TZZ Jvhvn1sWksvRF94RY6sk99AutvbCYBC1MPhoKYsZwg/+P7++jZG9xsLJMYtjfZV1bYnw FzAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mvista-com.20150623.gappssmtp.com header.s=20150623 header.b=uKODhxEV; 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 z5si11617936edx.165.2021.07.16.05.26.51; Fri, 16 Jul 2021 05:27:16 -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=@mvista-com.20150623.gappssmtp.com header.s=20150623 header.b=uKODhxEV; 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 S238373AbhGPM2p (ORCPT + 99 others); Fri, 16 Jul 2021 08:28:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237729AbhGPM2p (ORCPT ); Fri, 16 Jul 2021 08:28:45 -0400 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B96EC06175F for ; Fri, 16 Jul 2021 05:25:50 -0700 (PDT) Received: by mail-ot1-x32e.google.com with SMTP id 59-20020a9d0ac10000b0290462f0ab0800so9638181otq.11 for ; Fri, 16 Jul 2021 05:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mvista-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to; bh=jXHUmaf0y4/dZXXr0fZDyHacF0cZd0H8h+cDQdqOEEI=; b=uKODhxEVzy9dSJXhy+XN5tiHq9sMkKG1iBbWcWLaum2oTIcqLPxErKusLW0eBHNdHo 4PFs9E0S8/w514nndILWNOHjOfSkV+GYH13S2tB2Kwb5L/iqP7QgLrrCvpHZ0FCPDqUD qbe0LNORN+x5XFtt2QSb7VScrt+IW8Og8lZZDhDvGIe5kV4eoDjdQ59Zrpf0b1o08PSY y41gTB/MsAWAsKz5zW2Cs2laPSDiNfC+SkZa5lJjZcG2XegAu7y3fTW9M+XRHX6lYYBI wsdgbjq1im34CzGKj0qwWl+HLURAZfF3ATZujlS+50LwCYoXo3MvNsGybp+Y6fP4uSOe iUjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to; bh=jXHUmaf0y4/dZXXr0fZDyHacF0cZd0H8h+cDQdqOEEI=; b=p59aWCV/eXQO95e26VDS/FJH1Sknk87dXlETmA8AYD/sK3iNsvK7n9b/EOKMcCbpbT dtmLYiA9t2Axh1esa86Yd6Fi/56UXoKoZOZHUYX//pVYatR7JV/5zhaXbw5ZJvGf2G/g StzW8XkusKEix904XzcZoDWrgk0/NaXqXq/IlXQf2a1OmzOP+E2yWPFSVT3vrl+zJsRW Ezfo3ws5A43o7WsCsBxqwt22oLZYyOD0kWIrUpmWqCP+kaH2sMzmmc8kEmXBNpK4rtK3 /pPmUAVy/3KGc/JdR9AApRZRl9MpuqkyYoFYRtCQ85xI93Hl9DkQIVMsA7BwxyKPtqf+ 45xg== X-Gm-Message-State: AOAM5325k1emgbc2qQQ3c41UoBqdcacV93vSLyUqZqoPbvIKfbE4fxZ3 TPcQX8jPD0T/P88HAreptXPCLg== X-Received: by 2002:a9d:7a8e:: with SMTP id l14mr7790897otn.304.1626438349886; Fri, 16 Jul 2021 05:25:49 -0700 (PDT) Received: from minyard.net ([2001:470:b8f6:1b:8515:1333:671e:f6ae]) by smtp.gmail.com with ESMTPSA id y28sm1825305oti.80.2021.07.16.05.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 05:25:49 -0700 (PDT) Date: Fri, 16 Jul 2021 07:25:47 -0500 From: Corey Minyard To: Michal Hocko Cc: minyard@acm.org, Andrew Morton , 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: <20210716122547.GI3431@minyard.net> Reply-To: cminyard@mvista.com References: <20210701125430.836308-1-minyard@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -corey