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 2D8A1C43334 for ; Mon, 25 Jul 2022 18:37:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD08E940009; Mon, 25 Jul 2022 14:37:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA7BF940007; Mon, 25 Jul 2022 14:37:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A70E6940009; Mon, 25 Jul 2022 14:37:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9696E940007 for ; Mon, 25 Jul 2022 14:37:12 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 70578120556 for ; Mon, 25 Jul 2022 18:37:12 +0000 (UTC) X-FDA: 79726479504.26.A4E47AE Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf09.hostedemail.com (Postfix) with ESMTP id E52EC140009 for ; Mon, 25 Jul 2022 18:37:11 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 214DFB810C6; Mon, 25 Jul 2022 18:37:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BED5C341C8; Mon, 25 Jul 2022 18:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1658774228; bh=4Wiq9Lnn7t8N7Hq87zFN59DfW7ymVLg6HgcOtVLTQfQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=U29+o6jrPUXpJQUGJlHNswJaua64HHPjufTlSYWyAG42fPxw2nOflcBBCR88GILr3 0YK0c/4s6lGn+KW7LjJO/8bED+WRioxjF5k3Hby1NGwjg1Pw9F+usDwdQEYd6pe4Fm 5w0xxZZhcoizKDOreVP9a0tEW+2Vb2OjGtj5R+rM= Date: Mon, 25 Jul 2022 11:37:07 -0700 From: Andrew Morton To: Jaewon Kim Cc: minchan@kernel.org, bhe@redhat.com, vbabka@suse.cz, mgorman@techsingularity.net, hannes@cmpxchg.org, mhocko@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, gh21.hong@samsung.com, ytk.lee@samsung.com, jaewon31.kim@gmail.com Subject: Re: [PATCH v2] page_alloc: fix invalid watemark check on a negative value Message-Id: <20220725113707.e03007d0761423f642c15749@linux-foundation.org> In-Reply-To: <20220725095212.25388-1-jaewon31.kim@samsung.com> References: <20220725095212.25388-1-jaewon31.kim@samsung.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658774232; 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=+Z6p36e/2+CfJhI6OgaPDuVlhee2P3o5IoJuIcGn54Q=; b=sU+SMxLHO4N7eFnYJA6Gdid8d/6NIrOeZT60GUlah1QJhvtgP2VXFNuIoMBzDER8dXWzCn bwcdndqsUL5QDVvXyjNfNkDKDo1UorjAoknyoMddIClsdyRVxpI4FyjB9cD+QEtU49v8ee drfdrGlLKNKbqYr/w6zFilKFrubQYB0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=U29+o6jr; dmarc=none; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658774232; a=rsa-sha256; cv=none; b=dCxbRezh9gXbCvvnktNDWODGYYb/A4J2Um1D/92C+6j2s8OjZNmH1SzgmT4/6BjtY+jLcj j9qISDCGTfwhTWCpetYDcewlg6f9qYTtZ0cVG+iX6a3jqhxkZRD7Fq9aOAfkt/C06x1yc+ NhSAL0JLdA/LyqA4QNcMzkcssuYvxqU= X-Stat-Signature: gpfw8y7atoftnym9wmgue9ekgxkehs8h X-Rspamd-Queue-Id: E52EC140009 X-Rspam-User: X-Rspamd-Server: rspam12 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=U29+o6jr; dmarc=none; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1658774231-90802 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 Mon, 25 Jul 2022 18:52:12 +0900 Jaewon Kim wrote: > There was a report that a task is waiting at the > throttle_direct_reclaim. The pgscan_direct_throttle in vmstat was > increasing. > > This is a bug where zone_watermark_fast returns true even when the free > is very low. The commit f27ce0e14088 ("page_alloc: consider highatomic > reserve in watermark fast") changed the watermark fast to consider > highatomic reserve. But it did not handle a negative value case which > can be happened when reserved_highatomic pageblock is bigger than the > actual free. > > If watermark is considered as ok for the negative value, allocating > contexts for order-0 will consume all free pages without direct reclaim, > and finally free page may become depleted except highatomic free. > > Then allocating contexts may fall into throttle_direct_reclaim. This > symptom may easily happen in a system where wmark min is low and other > reclaimers like kswapd does not make free pages quickly. > > Handle the negative case by using MIN. > Thanks, I added cc:stable to this.