Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2274165rdb; Mon, 9 Oct 2023 20:59:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECMpT71+VqPHIl09l7FiAJP0l7fyI+aSnu6M0qAS/5LAQTUXKryYI+FxLH4hYkAK+qy7iU X-Received: by 2002:a05:6a20:72a2:b0:16b:d470:b403 with SMTP id o34-20020a056a2072a200b0016bd470b403mr11895318pzk.28.1696910350409; Mon, 09 Oct 2023 20:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696910350; cv=none; d=google.com; s=arc-20160816; b=b+jfPRRX3e8GF5kWuaDmNb2h4oHhZY0loAGPb2SS6DSN7mtSsqLf1IcGpHQoi6ERjX uX6ARKnm3FU0QR2sPkdOJh5rcqQ/vK0lNmPH7db16mkV0OyjF158MRdNn6k6zow1hSGc 9V/N6KTyc8OEzZCNt6zRCrmEOjEUSykdrbaWLdefN4T4OI63IWplbt72obRB/LCCe7/I cQ3R5jXU2Y/sHfBJQABOxzZuGB3rLjbz9Wqb5kE6FTecs4JylFVL/pYa/LvmXGY2w/2a 8kmR/pgkTuwT3XnvM9rQ0dsyPT71AdGBAQ7DVk312xCPOwSz4joWqRgA8xIK9zmGHonI yk6g== 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:date:subject:cc:to:from :dkim-signature; bh=xonbTILnfRDSSpwlD7/OIaZi3FMBcEwweuvW4yZCh2w=; fh=L//tD1YWBOLGmC+Qv/IgqLZxdUqSHcb98OWw7Q2uw4s=; b=msfOyxHw0TszhjIHMOsvhIzSxOPytHFJ6fFJyEc/HXfd32M/Os+T+UFOX9VchjlyGv P6WNIesa12F3iOURBPPRlDqhQv74iA3uRy2Lu3FxDI+wDFTHN2RvfsSMr33vt5JuzuM/ JTjBBamj78FHk27k2B4fsVz/jgrx1YMpxaToRhdizwAgUI3tGncxdf+jDwog4m2ZC6dL dmRpuUkCFR87I4kNRt1MDPvTU+cHdZ+L9oPyM+eC0Sb1RPkU++mciHDwA5JwJkTPhMmz RQ3fOTdF9Vx8e3DLDI1KqfvXzKFja/YdCDjFYy9aVOsUKerX+SHDQIT1TJ53/CZC5X9Z 7E7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="aj1TKu+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id h15-20020a056a00218f00b00690b8833ccbsi8882035pfi.270.2023.10.09.20.59.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 20:59:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="aj1TKu+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id DFD468027932; Mon, 9 Oct 2023 20:59:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442094AbjJJD6q (ORCPT + 99 others); Mon, 9 Oct 2023 23:58:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442086AbjJJD6p (ORCPT ); Mon, 9 Oct 2023 23:58:45 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74A2EA7; Mon, 9 Oct 2023 20:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=xonbTILnfRDSSpwlD7/OIaZi3FMBcEwweuvW4yZCh2w=; b=aj1TKu+/EtwxufLyebFk8DMNnQ 4UfGF4beGegRl9svNF5CGC8UMlk5h/XNEvviQQnRsb86wmbyKmOVzGmKiA9fTL3dadUOqvxayQgqr v16IZoYVhxC8zB7U+YMbEgAA7LrIoxiEftMqZzMDhtpXZFpDQxi9srXjZ2yE/hpaCZT1XzxEUlwzx 7c+b9g4gVNvfVNbtsmPwZAH9nJsebScv8IRnSBF39BwyAFFYt0JA4STfeMYbCpY1bz7h4tYnF1lWf IUwcIoIkSJ4FkWrc17yeLi4vvxY5aVeUZP/oRUrew/Ldg7pZ3I5l96aVSVcb1R+Z5nQoub/S3+48R tOwzb87A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qq3tC-002Haa-ET; Tue, 10 Oct 2023 03:58:34 +0000 From: "Matthew Wilcox (Oracle)" To: Bin Lai Cc: "Matthew Wilcox (Oracle)" , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, akpm@linux-foundation.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/2] filemap: Remove use of wait bookmarks Date: Tue, 10 Oct 2023 04:58:28 +0100 Message-Id: <20231010035829.544242-1-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231010032833.398033-1-robinlai@tencent.com> References: <20231010032833.398033-1-robinlai@tencent.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 09 Oct 2023 20:59:08 -0700 (PDT) X-Spam-Level: ** The original problem of the overly long list of waiters on a locked page was solved properly by commit 9a1ea439b16b ("mm: put_and_wait_on_page_locked() while page is migrated"). In the meantime, using bookmarks for the writeback bit can cause livelocks, so we need to stop using them. Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index f0a15ce1bd1b..1f9adad2d781 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1135,32 +1135,13 @@ static void folio_wake_bit(struct folio *folio, int bit_nr) wait_queue_head_t *q = folio_waitqueue(folio); struct wait_page_key key; unsigned long flags; - wait_queue_entry_t bookmark; key.folio = folio; key.bit_nr = bit_nr; key.page_match = 0; - bookmark.flags = 0; - bookmark.private = NULL; - bookmark.func = NULL; - INIT_LIST_HEAD(&bookmark.entry); - spin_lock_irqsave(&q->lock, flags); - __wake_up_locked_key_bookmark(q, TASK_NORMAL, &key, &bookmark); - - while (bookmark.flags & WQ_FLAG_BOOKMARK) { - /* - * Take a breather from holding the lock, - * allow pages that finish wake up asynchronously - * to acquire the lock and remove themselves - * from wait queue - */ - spin_unlock_irqrestore(&q->lock, flags); - cpu_relax(); - spin_lock_irqsave(&q->lock, flags); - __wake_up_locked_key_bookmark(q, TASK_NORMAL, &key, &bookmark); - } + __wake_up_locked_key(q, TASK_NORMAL, &key); /* * It's possible to miss clearing waiters here, when we woke our page -- 2.40.1