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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 74ACEC433F5 for ; Wed, 22 Sep 2021 14:13:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 108F9611CA for ; Wed, 22 Sep 2021 14:13:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 108F9611CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 36D636B006C; Wed, 22 Sep 2021 10:13:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F6476B0072; Wed, 22 Sep 2021 10:13:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BE776B0073; Wed, 22 Sep 2021 10:13:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 099786B006C for ; Wed, 22 Sep 2021 10:13:06 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B2B09182057FF for ; Wed, 22 Sep 2021 14:13:05 +0000 (UTC) X-FDA: 78615401130.29.369FC20 Received: from outbound-smtp15.blacknight.com (outbound-smtp15.blacknight.com [46.22.139.232]) by imf18.hostedemail.com (Postfix) with ESMTP id E44CC4002091 for ; Wed, 22 Sep 2021 14:13:04 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp15.blacknight.com (Postfix) with ESMTPS id 35E091C4C56 for ; Wed, 22 Sep 2021 15:13:03 +0100 (IST) Received: (qmail 20762 invoked from network); 22 Sep 2021 14:13:03 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 22 Sep 2021 14:13:03 -0000 Date: Wed, 22 Sep 2021 15:13:01 +0100 From: Mel Gorman To: Hillf Danton Cc: Linux-MM , NeilBrown , Dave Chinner , LKML Subject: Re: [PATCH 1/5] mm/vmscan: Throttle reclaim until some writeback completes if congested Message-ID: <20210922141301.GZ3959@techsingularity.net> References: <20210920085436.20939-1-mgorman@techsingularity.net> <20210922121620.4716-1-hdanton@sina.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20210922121620.4716-1-hdanton@sina.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E44CC4002091 X-Stat-Signature: 31dee9bbiq3ryijizouz1yq4j1jjb73s Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf18.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.232 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-HE-Tag: 1632319984-477234 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000043, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Sep 22, 2021 at 08:16:20PM +0800, Hillf Danton wrote: > On Mon, 20 Sep 2021 09:54:32 +0100 Mel Gorman wrote: > > +static void > > +reclaim_throttle(pg_data_t *pgdat, enum vmscan_throttle_state reason, > > + long timeout) > > +{ > > + wait_queue_head_t *wqh =3D &pgdat->reclaim_wait; > > + unsigned long start =3D jiffies; > > + long ret; > > + DEFINE_WAIT(wait); > > + > > + atomic_inc(&pgdat->nr_reclaim_throttled); > > + WRITE_ONCE(pgdat->nr_reclaim_start, > > + node_page_state(pgdat, NR_THROTTLED_WRITTEN)); > > Missing wakeup could happen if the current sleeper overwrites > pgdat->nr_reclaim_start set by the existing sleeper. > > if (1 == atomic_inc_and_return(&pgdat->nr_reclaim_throttled)) > WRITE_ONCE(pgdat->nr_reclaim_start, > node_page_state(pgdat, NR_THROTTLED_WRITTEN)); > Good spot, will fix. -- Mel Gorman SUSE Labs