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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 664E4D0E6C5 for ; Mon, 21 Oct 2024 17:48:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC5416B0082; Mon, 21 Oct 2024 13:48:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C754D6B0083; Mon, 21 Oct 2024 13:48:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B635C6B0085; Mon, 21 Oct 2024 13:48:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 99D366B0082 for ; Mon, 21 Oct 2024 13:48:14 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 489A41202DB for ; Mon, 21 Oct 2024 17:48:00 +0000 (UTC) X-FDA: 82698342594.07.68C0336 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) by imf26.hostedemail.com (Postfix) with ESMTP id 443F1140002 for ; Mon, 21 Oct 2024 17:48:01 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=YsCsBzZ5; spf=pass (imf26.hostedemail.com: domain of yuzhao@google.com designates 209.85.217.47 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729532816; a=rsa-sha256; cv=none; b=CnaFqCyfFiaML6dnLT+Ic9EheCSnRpa3svVYYbG1AHeWz4T5IS2SrVvpfp3Rl1pDHLLwdP nXMC+MmkAPGorKJ6u7CQs5vokNki3ZXNCyEVZsaEBUDURbWrVCnmWQ5gR5cg4B5rKSwdRg ZxD6NmriOXXOh3SHf0bTLtFNYy33K/s= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=YsCsBzZ5; spf=pass (imf26.hostedemail.com: domain of yuzhao@google.com designates 209.85.217.47 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729532816; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+6xfJqNYxgSFtrrbl27/AR1F/LasrkKf3mfqMuCjZvA=; b=Y3B4nIvMoEruDxkSalNXWELupF947UgeMESE91XRD1zjz7WeclesNoqGQA5E46TIhqcdqF oPYxxMmGvJQ/lcwFwibude5ParuLNA9Z4cU1FE6cBir8HfrFOBkVm4od1mINhexfDjBHcK u2CAzBm1ZsRioQ127mc2gbDFIneGYho= Received: by mail-vs1-f47.google.com with SMTP id ada2fe7eead31-4a5ad5c1c06so1398786137.3 for ; Mon, 21 Oct 2024 10:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729532891; x=1730137691; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+6xfJqNYxgSFtrrbl27/AR1F/LasrkKf3mfqMuCjZvA=; b=YsCsBzZ5MPR6XVah6lGGEas0RXbCSnBxOshnEfxWdmgjpjhzjYoP0YVByudar6hjbV w9DT5qfyQ//9xBqQM9rr/YGnnZLtwGOuMM1ZTPVR8kljzXhA/Y6/nF8F31jgYqH7Bk2w wjEzZTi40/ab3nthmZMcyYY4LctsDlsgZY3nOXcNhMeAPS+YPsgU+p4TZtYhULFelUB5 PnI3n8jFYn+u7ISCG5cVsYXoSvjS1Mnf3+omkJ/sNCMv5Zatkfg1j2VxBVaNpOwQyfKD jwhR34/OfcsDEaCAEsYJ0Z8vE9mLoSu2TtONp6M8Ymd9FieesvjT9XGTURmITRWBaUCv SdZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729532891; x=1730137691; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+6xfJqNYxgSFtrrbl27/AR1F/LasrkKf3mfqMuCjZvA=; b=lOOlUg+/6DTrMhQvTe01lXS6+A21ZEdv6LLtdz5HbDT1JaHW2cIzleFRBGRx28V5lp K9WrQtxP8Hvut8FOKjJJhSr4UKeQOAeKGJnP5nA+7WdMD/HbkVCGN4u4fdt7g2FPfXPF AmqNoivyE1YMyoXz1sS7t5TLVAJSoSjedDMUmctoaUHIabXNTHPgouZSdImNXtrthiIS iieIBOAwgMkzn3HYBX+sjmSbBWHkoWLvwVighwrRtmTgtI/PcNHbC32NWpYM84dtlboI Xxl3RBrKxrHekKPT8WWTqJDVAst5JLPad8V0ma0eu+08gmaUze8WhLHKm5sItGbqnegN Z1Sg== X-Forwarded-Encrypted: i=1; AJvYcCWq8K+t9r+OIahW7ZzAe+w42kUFw3ufAKvd1aPUpq56x73+1+lSISJ2zWXyOmXs7rz9tHy1uAexXw==@kvack.org X-Gm-Message-State: AOJu0YzvmkPGQ0c/83CdtDQNueKFhNbcJqM2RQ2J2Jvg9KLpVzQhSE+q Y36POvtNxB2zkCML7CGDsGC7yLVEvg6cYwVFgucV1DUfo9suOVrnEFENgzhI3am/kuhhoZ2jtXQ 1KwJn6Tm2c5Jvc1ibkteMH9qQxGA+2RWK6ze6 X-Google-Smtp-Source: AGHT+IETp+/g0y6U2XpbcP6t4HQIZ/PhZV/J5zf4SqFEuZHZNKc76kVZXpwgJLipoLo4+tdDXiuA+OueSYtg03V886I= X-Received: by 2002:a05:6102:3052:b0:4a4:7609:35f with SMTP id ada2fe7eead31-4a5d6beb2e7mr9296702137.24.1729532891284; Mon, 21 Oct 2024 10:48:11 -0700 (PDT) MIME-Version: 1.0 References: <20241020051315.356103-1-yuzhao@google.com> In-Reply-To: From: Yu Zhao Date: Mon, 21 Oct 2024 11:47:34 -0600 Message-ID: Subject: Re: [PATCH mm-unstable v1] mm/page_alloc: try not to overestimate free highatomic To: Michal Hocko Cc: Andrew Morton , David Rientjes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Link Lin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: 9mnjedb3xfxghbegt7bzeiiszds61ft3 X-Rspamd-Queue-Id: 443F1140002 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1729532881-101691 X-HE-Meta: U2FsdGVkX18kTsNfKxbdrWbyiWl7SsasaqYyc87+T8sJPagAPSxzD1MHBY9vFD3UF1/ih5G3K+Xsct3UFaMe9c421E0LUJd+m4jYGRTtRpJNswTpRBUEviZHPEFTtYpEcr5bnS324zGk4sTC08H/viFMQzsZKwYeOSvHIQ7M6UUaAstddL1btgEi58LvJpNF/HLqH46FrkzyFR9jDsBo2ui2mVFWQOoKwwRdfIKMaP1UILezMWo+uQgx1zbguKu0KD/lHkJdThUCcyb9BokYlXMfHBhhb23BeRWeL8789UT1U7FNJtBBCrnWbW94P5qeYBWme/LsQwSHJbRvab32ZHicH4S10/RRSirPxCwkRIBYPoYrd8j8G5m2lijcLGwsQTeUbeqyTZTxdbBV7eQoqkdfZ7MWivOq5vttVJwKBPq/q1gFKeWtZBNscY2Jp90qWVtrzF53wSImEBnkQ2jZsPPiKA4kAaMn+Igyfn6yXqioKyLy0aBAKWJaH5140HXk1ou/WbP77h6pbm6tLHP7P2NxijxdzI6WilvyEtNT7vDKOwW+67i/CLhsw1vp8yyFFD4Vv77QQhqKKgUHgmggjA3TlDiI6ZwrZRp1xhNrrFAhYTZXQlSfoBrYhodgA11WNMW7Q5Dl4uKfzC/rrY//DqW9wNvPNEHNx2iEBUQARO+CZIcdqmwLGGUBx3gmK0L16D1YahGCQixDRWqKlHvSeobZ5VixWYb2y44urItMJSVFbUOucxquz3tlbrj5w027BdOpi9IJ6v84WCZBeuwnXxDdJJqzl9CTvEo1czWmcPbM6/m94xLpfGJSFH3UAHG+UImnVkKHgimBTXDeExB0CBFkf+qt9xDPW0k2Tzog8vhfyJzW076mQjgF/kqopWNM04OW28aSxDlXSiy0bkvfB2LX/pMsD6unwxtmFHFbkFIeP87A3b7SFS4/UVKbGhmgeYBJC4rF7N0BnMzYO9S cuI9JCE+ BeS//Mwoi6yrRar+zbbEmWegzo1fC5NMGt0mGVRt5LFX6feunpTggScvO2+Kt6KRtpxsgR0M/XNivuLh1+N0cAmtqIqreBLZtnLbp5/g+RsvjTYpstRW+Uev3pKxbr3ZNuPJ2qZone28RhtXOQ65yBHIORA+gz4nJ4KrsQcrdJixFGrMWI2HYjrO3PDzUcra0NSeKzQ7/QN8DSo/kRLRifQbi49Ggc4A3KbOedj6NY6D5ugzJJShZ2+H9B2S0eBOtcb8gZnVfiyDzRmDcCfScMS5eibY9D5z/oOugkzDjHPH8uZ0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000042, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Oct 21, 2024 at 11:26=E2=80=AFAM Michal Hocko wro= te: > > On Mon 21-10-24 11:10:50, Yu Zhao wrote: > > On Mon, Oct 21, 2024 at 2:13=E2=80=AFAM Michal Hocko = wrote: > > > > > > On Sat 19-10-24 23:13:15, Yu Zhao wrote: > > > > OOM kills due to vastly overestimated free highatomic reserves were > > > > observed: > > > > > > > > ... invoked oom-killer: gfp_mask=3D0x100cca(GFP_HIGHUSER_MOVABLE)= , order=3D0 ... > > > > Node 0 Normal free:1482936kB boost:0kB min:410416kB low:739404kB = high:1068392kB reserved_highatomic:1073152KB ... > > > > Node 0 Normal: 1292*4kB (ME) 1920*8kB (E) 383*16kB (UE) 220*32kB = (ME) 340*64kB (E) 2155*128kB (UE) 3243*256kB (UE) 615*512kB (U) 1*1024kB (M= ) 0*2048kB 0*4096kB =3D 1477408kB > > > > > > > > The second line above shows that the OOM kill was due to the follow= ing > > > > condition: > > > > > > > > free (1482936kB) - reserved_highatomic (1073152kB) =3D 409784KB <= min (410416kB) > > > > > > > > And the third line shows there were no free pages in any > > > > MIGRATE_HIGHATOMIC pageblocks, which otherwise would show up as typ= e > > > > 'H'. Therefore __zone_watermark_unusable_free() overestimated free > > > > highatomic reserves. IOW, it underestimated the usable free memory = by > > > > over 1GB, which resulted in the unnecessary OOM kill. > > > > > > Why doesn't unreserve_highatomic_pageblock deal with this situation? > > > > The current behavior of unreserve_highatomic_pageblock() seems WAI to > > me: it unreserves highatomic pageblocks that contain *free* pages so > > that those pages can become usable to others. There is nothing to > > unreserve when they have no free pages. > > I do not follow. How can you have reserved highatomic pages of that size > without having page blocks with free memory. Sorry I might still not get your question: are you saying it's not possible for 524 pageblocks (reserved_highatomic=3D1073152kB) not to have free pages? It might be uncommon but I don't think it's impossible. > In other words is this an > accounting problem or reserves problem? I don't follow here: why does it need to be one of the two? reserved_highatomic can go up to 1% of the zone, and all reserves can be used for highatomic allocs, leaving no free pages in reserved_highatomic.