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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 0C95AC433F5 for ; Fri, 3 Sep 2021 01:52:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AC66F610A0 for ; Fri, 3 Sep 2021 01:52:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AC66F610A0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3062A900002; Thu, 2 Sep 2021 21:52:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 28DD08D0001; Thu, 2 Sep 2021 21:52:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12E94900002; Thu, 2 Sep 2021 21:52:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0134.hostedemail.com [216.40.44.134]) by kanga.kvack.org (Postfix) with ESMTP id F11258D0001 for ; Thu, 2 Sep 2021 21:52:14 -0400 (EDT) Received: from smtpin39.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B9FB31849A3BC for ; Fri, 3 Sep 2021 01:52:14 +0000 (UTC) X-FDA: 78544586988.39.6A57624 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) by imf16.hostedemail.com (Postfix) with ESMTP id 7B696F000090 for ; Fri, 3 Sep 2021 01:52:14 +0000 (UTC) Received: by mail-oi1-f176.google.com with SMTP id w144so4563977oie.13 for ; Thu, 02 Sep 2021 18:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:reply-to:references :mime-version:content-disposition:in-reply-to; bh=fJ6dHpD3GNvelFyzfgcEEqTGVW548hBc/w/cwdZoxXo=; b=o5wGgjqoy5Wypn47ILH2PfB1fPMzxONkyeKsNK/ucG6hBFF1UqOy3mQYhBu5n42jzT bwsWPaj+bIf84sI/0LdRvyucZCbLAPJ+96yqtO1W0YNvaiNpAwg/pH3Srl/DqF1jBcbn uNMFUesRjHUeT7odYJ6xVGTcAzOh/xH1fs1130ngy67zKgpCnSk8dFeRSwBHD1lfW3z2 xRBPCr8Vx8p8qnVyxzkNoqzInZU9IDrNH481FyEoC0OEDxqRZQdyA2hYYDSrf04WeLsY pNA9mSfEpHAhcM89+gxWw1yzpz1lEHHY/G+dJN+oO6nS4KU+ji5vw0yuyRo3Slobm1Ak weSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :reply-to:references:mime-version:content-disposition:in-reply-to; bh=fJ6dHpD3GNvelFyzfgcEEqTGVW548hBc/w/cwdZoxXo=; b=CLxWltMCktngJgSkiLmTa3AD0nwBzCmhqOxZMyWKR5e213ckrLZY6kw0HrUmAW5Q2f jS2NfLofONBSSy5TKl38pHmThr1Pb5Ier9WHlslJMf9ll+1cSATL/mbE6bUh6eVqo3C1 IUWfkx3aH1hYbOGGg3O8gyV1iyFxqN5q8EoFR7PYH8qpuu+T9jxzhq3tvIWp98eRLR02 1sHWB6Dl2nPYRV0sq5FhIYdXOfW7POeKGGAhG3LCb+IL0m8awV16aG3s/4PLB9YbHxtd ZQvA5qlkQc+k8snRVGs1avG+QsJ5Z+cz8NEiyJXQO7MNDNcDSU8XZTEWUjBTMWOLl7kC XffA== X-Gm-Message-State: AOAM531b2mVoCqRwon+AiY+bdxgI6cmTfdYDMfGbcviBdvptaTf4/kMA G+kc/t4TO99+8RSanO92+O8RwOv+0w== X-Google-Smtp-Source: ABdhPJzNeiL7f0eAEUR9xjNEuOWjCTsyhykW7lhmG1ZQ9+Ss7OYiuLg0+6E5hUwPc3JdgolBcrUOFQ== X-Received: by 2002:a05:6808:3a8:: with SMTP id n8mr4476992oie.10.1630633933476; Thu, 02 Sep 2021 18:52:13 -0700 (PDT) Received: from serve.minyard.net ([47.184.156.158]) by smtp.gmail.com with ESMTPSA id a23sm690696otp.44.2021.09.02.18.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 18:52:12 -0700 (PDT) Received: from minyard.net (unknown [IPv6:2001:470:b8f6:1b:5c43:c5c8:4983:ece]) by serve.minyard.net (Postfix) with ESMTPSA id 6B17418000C; Fri, 3 Sep 2021 01:52:11 +0000 (UTC) Date: Thu, 2 Sep 2021 20:52:10 -0500 From: Corey Minyard To: Andrew Morton Cc: cminyard@mvista.com, Michal Hocko , 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: <20210903015210.GF545073@minyard.net> Reply-To: minyard@acm.org 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> Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=o5wGgjqo; spf=pass (imf16.hostedemail.com: domain of tcminyard@gmail.com designates 209.85.167.176 as permitted sender) smtp.mailfrom=tcminyard@gmail.com; dmarc=none X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 7B696F000090 X-Stat-Signature: obiqqrkyy3r84zajoq5o1c7jnt85a36f X-HE-Tag: 1630633934-708884 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, Sep 02, 2021 at 12:55:01PM -0700, 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? My goal in submitting this is to avoid someone having to go through what I went through. I know it now, so it's not going to affect me again. We could document this, but to me it seems silly when something can just be made consistent to avoid having to document it. I got no response to my questions above, so I don't know what to make of it. Thanks Andrew, -corey