lkml.org 
[lkml]   [2023]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.10 18/19] dm cache: add cond_resched() to various workqueue loops
    Date
    From: Mike Snitzer <snitzer@kernel.org>

    [ Upstream commit 76227f6dc805e9e960128bcc6276647361e0827c ]

    Otherwise on resource constrained systems these workqueues may be too
    greedy.

    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 9b2aec3098010..f98ad4366301b 100644
    --- a/drivers/md/dm-cache-target.c
    +++ b/drivers/md/dm-cache-target.c
    @@ -1883,6 +1883,7 @@ static void process_deferred_bios(struct work_struct *ws)

    else
    commit_needed = process_bio(cache, bio) || commit_needed;
    + cond_resched();
    }

    if (commit_needed)
    @@ -1905,6 +1906,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();
    }
    }

    @@ -1945,6 +1947,8 @@ static void check_migrations(struct work_struct *ws)
    r = mg_start(cache, op, NULL);
    if (r)
    break;
    +
    + cond_resched();
    }
    }

    --
    2.39.0
    \
     
     \ /
      Last update: 2023-03-27 00:36    [W:2.537 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site