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=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 9F164C433E0 for ; Wed, 8 Jul 2020 19:02:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 67A24206E2 for ; Wed, 8 Jul 2020 19:02:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67A24206E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D56846B0008; Wed, 8 Jul 2020 15:02:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D07ED6B000A; Wed, 8 Jul 2020 15:02:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1D7F6B000C; Wed, 8 Jul 2020 15:02:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id AD4826B0008 for ; Wed, 8 Jul 2020 15:02:30 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 392AD8248D52 for ; Wed, 8 Jul 2020 19:02:30 +0000 (UTC) X-FDA: 77015829660.24.deer97_35122cd26ebf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 010BC1A4A7 for ; Wed, 8 Jul 2020 19:02:29 +0000 (UTC) X-HE-Tag: deer97_35122cd26ebf X-Filterd-Recvd-Size: 4329 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Wed, 8 Jul 2020 19:02:29 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id 17so4307088wmo.1 for ; Wed, 08 Jul 2020 12:02:29 -0700 (PDT) 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=NDHzT9jovhETaEfPleAEdEx6TJFQGzSj15eCGxIZYWc=; b=QROnjZE7WrB4YvadUnlLSwxxCIcxzt2DozeVC+fXW9Hsrl2Rh6H0ZjbpxfasnsBBX3 rbd25eVDWPJ70qm29zhfbvttZkf5tORMY1O6wXjyyX7pvXy+FcRJabD+ixQu6h6ly33F wCrF/GTkVQN4DIliO4jOBEWptAA73mUCej299sweSEYCyRiQX6Nda66Ze/CHUf/UWElz 9litb87zNzqwapGracTuyrnxcUBLDa9YWUiZ68dlG5a8PD5Wv1FVRwL12CUzPSiIIYZX MMqabyqF2I915qtP72NjUgh1vdVpySYUfbBYmg8yuF1biwQWr2vJD3T8ozb7phBTtHZA Fy+A== X-Gm-Message-State: AOAM530gSc/dWRSp8179tPovScilFrJXvUmryTGpKmmgIoxVly71qDyR Xgk0F5tjlDPgNxo+rDii0nw= X-Google-Smtp-Source: ABdhPJww6yd19n4YM8kGEhUdONweeTnAxSXQxl3IyX4yvUEaPwZUY1CiYuCc8EFPuU+nJLsfe25aDw== X-Received: by 2002:a1c:668b:: with SMTP id a133mr10536254wmc.10.1594234948382; Wed, 08 Jul 2020 12:02:28 -0700 (PDT) Received: from localhost (ip-37-188-179-51.eurotel.cz. [37.188.179.51]) by smtp.gmail.com with ESMTPSA id b18sm1276336wrs.46.2020.07.08.12.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 12:02:27 -0700 (PDT) Date: Wed, 8 Jul 2020 21:02:25 +0200 From: Michal Hocko To: David Rientjes Cc: Yafang Shao , akpm@linux-foundation.org, linux-mm@kvack.org Subject: Re: [PATCH] mm, oom: make the calculation of oom badness more accurate Message-ID: <20200708190225.GM7271@dhcp22.suse.cz> References: <1594214649-9837-1-git-send-email-laoar.shao@gmail.com> <20200708142806.GJ7271@dhcp22.suse.cz> <20200708143211.GK7271@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 010BC1A4A7 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.007007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 08-07-20 10:57:27, David Rientjes wrote: > On Wed, 8 Jul 2020, Michal Hocko wrote: >=20 > > I have only now realized that David is not on Cc. Add him here. The > > patch is http://lkml.kernel.org/r/1594214649-9837-1-git-send-email-la= oar.shao@gmail.com. > >=20 > > I believe the main problem is that we are normalizing to oom_score_ad= j > > units rather than usage/total. I have a very vague recollection this = has > > been done in the past but I didn't get to dig into details yet. > >=20 >=20 > The memcg max is 4194304 pages, and an oom_score_adj of -998 would yiel= d a=20 > page adjustment of: >=20 > adj =3D -998 * 4194304 / 1000 =3D =E2=88=924185915 pages >=20 > The largest pid 58406 (data_sim) has rss 3967322 pages, > pgtables 37101568 / 4096 =3D 9058 pages, and swapents 0. So it's unadj= usted=20 > badness is >=20 > 3967322 + 9058 pages =3D 3976380 pages >=20 > Factoring in oom_score_adj, all of these processes will have a badness = of=20 > 1 because oom_badness() doesn't underflow, which I think is the point o= f=20 > Yafang's proposal. >=20 > I think the patch can work but, as you mention, also needs an update to= =20 > proc_oom_score(). proc_oom_score() is using the global amount of memor= y=20 > so Yafang is likely not seeing it go negative for that reason but it co= uld=20 > happen. Yes, memcg just makes it more obvious but the same might happen for the global case. I am not sure how we can both alow underflow and present the value that would fit the existing model. The exported value should really reflect what the oom killer is using for the calculation or we are going to see discrepancies between the real oom decision and presented values. So I believe we really have to change the calculation rather than just make it tolerant to underflows. But I have to think about that much more. --=20 Michal Hocko SUSE Labs