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=-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 B3813C07E95 for ; Fri, 16 Jul 2021 05:19:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98560613E8 for ; Fri, 16 Jul 2021 05:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234152AbhGPFWW (ORCPT ); Fri, 16 Jul 2021 01:22:22 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:35526 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231348AbhGPFWV (ORCPT ); Fri, 16 Jul 2021 01:22:21 -0400 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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