From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D80B4BA49 for ; Tue, 7 Mar 2023 18:32:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49540C433D2; Tue, 7 Mar 2023 18:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678213950; bh=c9CyTiVATKApjeA+HLuDo6SYgSrQTzWUQZSCT6MGW5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w1rp0jS3eWhbcGnu40c/X2emkwDi4PiK5+xfEEXAGccUDJ707ipiMW/30BkVMe5qh dF5I5E3nVj1lNDwUbYMhY0Pv+Jrli0Jr/Z125D4kIXUgmjuuVHvRgWsmyOYqdD2ir6 S1ALHQ/fgjVTdmKYtTKQDGEpy7a4fQDus+3tAv6Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mike Snitzer , Sasha Levin Subject: [PATCH 6.1 641/885] dm cache: add cond_resched() to various workqueue loops Date: Tue, 7 Mar 2023 17:59:35 +0100 Message-Id: <20230307170029.999622540@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307170001.594919529@linuxfoundation.org> References: <20230307170001.594919529@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 5e92fac90b675..17fde3e5a1f7b 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -1805,6 +1805,7 @@ static void process_deferred_bios(struct work_struct *ws) else commit_needed = process_bio(cache, bio) || commit_needed; + cond_resched(); } if (commit_needed) @@ -1827,6 +1828,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(); } } @@ -1867,6 +1869,8 @@ static void check_migrations(struct work_struct *ws) r = mg_start(cache, op, NULL); if (r) break; + + cond_resched(); } } -- 2.39.2