Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp129164imn; Mon, 25 Jul 2022 11:46:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tw5QMO1HquO6WhonR94coqUXWBnIW4DDSpQPjhbd8Bu4QmFZJyXjs1I70bHmuObJ4uo4bk X-Received: by 2002:a17:906:9be4:b0:72b:cf9:99d8 with SMTP id de36-20020a1709069be400b0072b0cf999d8mr11015974ejc.747.1658774785049; Mon, 25 Jul 2022 11:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658774785; cv=none; d=google.com; s=arc-20160816; b=j0hZPyHGrDaK/reRpRx433AacrMvcoZCHSTkklRmStsfCYJvz1pr5dn9e9k7Z76SM/ vflyduytkNlooOs+rg/o1ktQOOcGz7AD537qx9wXoxZs96AJSNGRY5TOp4UzVTvO4Zxb kDnoxpewqYmlxwtjGZH5dgrf5L/DX9N7AnOHT2WumQ6JT9CLM1mOEBL4hc/dYsOck6on H6DoINq/K+gzjTxJTElI9FYhQbGTfgFOtTcUrAElfMQksvJhziICLWd/s49Sg3XIOWUQ 7NbiQ4uUYwFAq5xip6SptUaSueWpfXNW1UMpkt4ol+Et2mkOT/LDj+wKi8XtcyMHts7C weCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=+Z6p36e/2+CfJhI6OgaPDuVlhee2P3o5IoJuIcGn54Q=; b=tHNbj8nYmsIc2FOnIrwKczAZ261B56kKU2UkqXY/Wns9NZrbxEpjtVh/JeanbGqe7W cItHxt6j0QUs4am+2NfGQ7fSeoSmCrB0xkUyJ1R83l3Byxpz+rFdhhWL2dG/j6X7JeY5 U7HMvkq4cAubbli+4m6cv9K5vQC6DCr1fHcz3+0Ck/LqB4kkO8ht4nB02WsVDtwirTVV h9URo7QW3ZU3/9je5JwEwL7L7M/xNHSjfH7X0imxrzVox3rOGkKriCN7dDvOzvAdN3zi tq79pgceeu2fN8e1De5VHolFnYltAJuCNp5AuDRlBH2CmIxU7i5y1Hl/BfOdGQ3kvGSt 1Bog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=U29+o6jr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a056402135600b0043bbc88bf3bsi5632821edw.94.2022.07.25.11.46.00; Mon, 25 Jul 2022 11:46:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=U29+o6jr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230455AbiGYSh0 (ORCPT + 99 others); Mon, 25 Jul 2022 14:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236433AbiGYShR (ORCPT ); Mon, 25 Jul 2022 14:37:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E6361F61D for ; Mon, 25 Jul 2022 11:37:10 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 7408360B8D for ; Mon, 25 Jul 2022 18:37:09 +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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.