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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2016FC6FD1F for ; Fri, 10 Mar 2023 14:36:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232648AbjCJOgv (ORCPT ); Fri, 10 Mar 2023 09:36:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232653AbjCJOgl (ORCPT ); Fri, 10 Mar 2023 09:36:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7EE911ACB4 for ; Fri, 10 Mar 2023 06:36:24 -0800 (PST) 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 52F40618A6 for ; Fri, 10 Mar 2023 14:36:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49293C433EF; Fri, 10 Mar 2023 14:36:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678458983; bh=XPibhNH8TNsYk8yAiU34P2Do5UaEGUHLtxxRvd2ZyCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLuJvg3sPyFFnbhmq0iNpCUMXuhSUC82vLndXwJGp2D1NXhdGUNzz6GBKHKdjcTD1 EpINa9/iYtEE5aXoClUHmvmsYe4j+rI0VPd8rtGvZ1KUv0oB3sVESIrWXdsWXMWqPj 8b9NeGti/qhifvfMDfepCOghHgAhCUn7NqyzdNdo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mike Snitzer , Sasha Levin Subject: [PATCH 5.4 209/357] dm cache: add cond_resched() to various workqueue loops Date: Fri, 10 Mar 2023 14:38:18 +0100 Message-Id: <20230310133743.932431010@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310133733.973883071@linuxfoundation.org> References: <20230310133733.973883071@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mike Snitzer [ Upstream commit 76227f6dc805e9e960128bcc6276647361e0827c ] Otherwise on resource constrained systems these workqueues may be too greedy. Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm-cache-target.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 10b2a4e10a46b..08b5e44df3248 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -1910,6 +1910,7 @@ static void process_deferred_bios(struct work_struct *ws) else commit_needed = process_bio(cache, bio) || commit_needed; + cond_resched(); } if (commit_needed) @@ -1932,6 +1933,7 @@ static void requeue_deferred_bios(struct cache *cache) while ((bio = bio_list_pop(&bios))) { bio->bi_status = BLK_STS_DM_REQUEUE; bio_endio(bio); + cond_resched(); } } @@ -1972,6 +1974,8 @@ static void check_migrations(struct work_struct *ws) r = mg_start(cache, op, NULL); if (r) break; + + cond_resched(); } } -- 2.39.2