Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6640377rwr; Tue, 25 Apr 2023 01:11:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ46nycEkt5nuolfXoZAqfEs3PPahT13JmO9F26jifIaHO4vL9zJKoRE8nYKMDEQMzoKSjP4 X-Received: by 2002:a17:902:d505:b0:1a9:8769:36b7 with SMTP id b5-20020a170902d50500b001a9876936b7mr3515425plg.5.1682410307463; Tue, 25 Apr 2023 01:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682410307; cv=none; d=google.com; s=arc-20160816; b=LcjStQ835t0SBvEed5+rHoZMHf8Tyy0N1UiqqMvG+Xq7hPebBcidkFLYu8U9sNoP9+ 65kOkcYw25H2VtnSuivpBE0Kv7AdA9eovfxL6M4BCh7An0rx1+kYSzUDa6Hy4+RSE1Es Goom51pn26adO3bgKMiaRzPEnlCFsEk6ssNlHNuF4SfxmsA+V945VZ+3Wu1zDJulmza3 wH3h2smyVdM4DKnW2TkFhM7bXyBukeGI5TKiHGSslQ1ijQdC07g/FeKyy5yeO18cdjIk bKRicKVSyKcoqH09yiDufYc1GYjZZiPymQLn6jeBovtQGtW2PByB17CFWUYmKgL2CCE3 fzdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=XNctmVb5wFnTOj2zhSnCLm5uiWTL+XqxcJ23KKtrBTo=; b=E2EbX0EGGggEszeqzXgdxg5/We5X/oxOMohLIxbleRRa/xXyt4J805nkljzxUQwyig lepFLakeg4GI8+KhGdyusyQqr8zhI9b+hh2/Wn2cctysH3J7FIv2pWa2nm9sJ8h7svqF MPrlnVenUm89nS6g1zOnyzuMkDh+n1+hPdniiYXmZJEqiOyrRL/6XT9lKj+yZaEk7NwV TrEcO5V+52COsOR7+yxxZnabAwkwPFrOVsc04j9m4SF9j+7gGTNpvA+z3nzwN3kSGCle gJD+1f/uxn9CK97sjL2nYkp1fWmkfiwdNrla0WaXBbS9DRxNx57wcRnXKpiBqaFwuOg1 3GyA== ARC-Authentication-Results: i=1; mx.google.com; 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 o17-20020a170902d4d100b0019a96849d6dsi14240445plg.605.2023.04.25.01.11.30; Tue, 25 Apr 2023 01:11:47 -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; 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 S233525AbjDYIBG (ORCPT + 99 others); Tue, 25 Apr 2023 04:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233518AbjDYIA5 (ORCPT ); Tue, 25 Apr 2023 04:00:57 -0400 Received: from outbound-smtp24.blacknight.com (outbound-smtp24.blacknight.com [81.17.249.192]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A5B410F3 for ; Tue, 25 Apr 2023 01:00:56 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp24.blacknight.com (Postfix) with ESMTPS id 76D64C0C26 for ; Tue, 25 Apr 2023 09:00:54 +0100 (IST) Received: (qmail 23226 invoked from network); 25 Apr 2023 08:00:54 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.21.103]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 25 Apr 2023 08:00:54 -0000 Date: Tue, 25 Apr 2023 09:00:52 +0100 From: Mel Gorman To: Doug Anderson Cc: Andrew Morton , Vlastimil Babka , Ying , Alexander Viro , Christian Brauner , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yu Zhao , linux-fsdevel@vger.kernel.org, Matthew Wilcox Subject: Re: [PATCH v2 1/4] mm/filemap: Add folio_lock_timeout() Message-ID: <20230425080052.63dik4aadlrjvd2p@techsingularity.net> References: <20230421221249.1616168-1-dianders@chromium.org> <20230421151135.v2.1.I2b71e11264c5c214bc59744b9e13e4c353bc5714@changeid> <20230424082254.gopb4y2c7d65icpl@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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, Apr 24, 2023 at 09:22:55AM -0700, Doug Anderson wrote: > Hi, > > On Mon, Apr 24, 2023 at 1:22???AM Mel Gorman wrote: > > > > > @@ -1295,10 +1296,13 @@ static inline int folio_wait_bit_common(struct folio *folio, int bit_nr, > > > /* Loop until we've been woken or interrupted */ > > > flags = smp_load_acquire(&wait->flags); > > > if (!(flags & WQ_FLAG_WOKEN)) { > > > + if (!timeout) > > > + break; > > > + > > > > An io_schedule_timeout of 0 is valid so why the special handling? It's > > negative timeouts that cause schedule_timeout() to complain. > > It's not expected that the caller passes in a timeout of 0 here. The > test here actually handles the case that the previous call to > io_schedule_timeout() returned 0. In my patch, after the call to > io_schedule_timeout() we unconditionally "continue" and end up back at > the top of the loop. The next time through the loop if we don't see > the WOKEN flag then we'll check for the two "error" conditions > (timeout or signal pending) and break for either of them. Ah, I see! > > To make it clearer, I'll add this comment for the next version: > > /* Break if the last io_schedule_timeout() said no time left */ Yes please. -- Mel Gorman SUSE Labs