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.8 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 A275EC12002 for ; Fri, 16 Jul 2021 05:19:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3CA5C61103 for ; Fri, 16 Jul 2021 05:19:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CA5C61103 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 806648D00F4; Fri, 16 Jul 2021 01:19:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B69D8D00EC; Fri, 16 Jul 2021 01:19:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67E828D00F4; Fri, 16 Jul 2021 01:19:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 3F09F8D00EC for ; Fri, 16 Jul 2021 01:19:29 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id F2FD4181D860F for ; Fri, 16 Jul 2021 05:19:27 +0000 (UTC) X-FDA: 78367298016.35.AA1EBAB Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf13.hostedemail.com (Postfix) with ESMTP id 6B67310096D2 for ; Fri, 16 Jul 2021 05:19:27 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E5FB022B14; Fri, 16 Jul 2021 05:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1626412765; 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=BD+bwgJlKaDPTTvGC7chlbRZwU3e79262cqlfKCLm0g=; b=PYB05WVjUHS/DEdLxHN1PnWD2keEb+Yt2r9KUzP/rPypZgl+CIbN0SOKRPWgEfTddILJl1 k1lFIgGcFo9p5BenOV5wl/v+ZyJ3rBZnp4k49kROr26XfPHIfUAWQv5eEU+d0ECeam0ewB LcLYR1c4Yvq+QqmOii/ujH/0FadRVHc= 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 260E0A3BB0; Fri, 16 Jul 2021 05:19:25 +0000 (UTC) Date: Fri, 16 Jul 2021 07:19:24 +0200 From: Michal Hocko To: minyard@acm.org Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Corey Minyard Subject: Re: [PATCH] oom_kill: oom_score_adj broken for processes with small memory usage Message-ID: References: <20210701125430.836308-1-minyard@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210701125430.836308-1-minyard@acm.org> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6B67310096D2 X-Stat-Signature: gepg6d6w9yr1ws7c9u93x3xhhjq7i1yj Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=PYB05WVj; spf=pass (imf13.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-HE-Tag: 1626412767-177424 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 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. 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. -- Michal Hocko SUSE Labs