Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp995244pxv; Thu, 15 Jul 2021 22:20:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkcNOn3K7QuV0A2xQfVozNeXhlnz9oXfg7Pt2Ts8bHA94mMtfl3OoXBbcWrZslkaobV6vO X-Received: by 2002:a05:6638:1915:: with SMTP id p21mr7231856jal.104.1626412824043; Thu, 15 Jul 2021 22:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626412824; cv=none; d=google.com; s=arc-20160816; b=ahDqkridfLIo/vJh0ziWsUHr+eAluToUO7VlFSUKRX+T8M2EYRZ7+33wZ6h5IhWlPi ThHav+daoezB2/M9LuDxl2ONiy9bhPjF2gEDY+DN8B8nuSpH2N54q6fSj6QUZE5VDJU4 KUp3uvSHcOvWCmMotnVOczx6dlQJIbXxkggA9CZR/RIa7bzxRy4a9ZQpe5ZQLVCeHpH8 hUvpiiHT4vJkhy2GP1n8irBji4IorMVoBqxCB1aME9yx/TloNlf54YCTPxbecfBdaKWP J1e6WrNN5a3s4eYWym4RSUahh1PffNX5he/5YY0T1szE8Avmm0uYLEw4OVJAhtZPKNt0 2hmA== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=BD+bwgJlKaDPTTvGC7chlbRZwU3e79262cqlfKCLm0g=; b=XrDcdOaq0A2oPfK9A0vNjwTe/kzxJG3mFuJljQUIfCeLfZQQQtH5CGQ4mfu/lqV4iy h0BRbPgEuIkfZu+OG1/wyTo5fEsYwzU4P3oO8U902zBtyoMCRt1nwVUMLQI+BnxjkW3S 4zTXWceUbhLjLb842CIKL+m/u1u6UgkQCnAw6kSBw43ylHDqLVcqug/y39sfHyFp3aPb IVczhy2zKnbhvGblk1WMPynLBWTkD1MbOFRvZXCFiiD4TcgGGS+EHIDmSLO/V4WV3ODv SOHj0nZtWciux3jT8Pu5K+616ltBpmbV9+SZ4EtxwKvebHsakocHPXcx+1S7AzNVvIWN tV9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=PYB05WVj; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v20si9224343jao.88.2021.07.15.22.20.11; Thu, 15 Jul 2021 22:20:24 -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=@suse.com header.s=susede1 header.b=PYB05WVj; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234099AbhGPFWV (ORCPT + 99 others); Fri, 16 Jul 2021 01:22:21 -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