FAILED: patch "[PATCH] blk-wbt: Fix detection of dirty-throttled tasks" failed to apply to 5.15-stable tree
Subsystems (5)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x f814bdda774c183b0cc15ec8f3b6e7c6f4527ba5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024021921-unspoiled-despite-59cc@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
f814bdda774c ("blk-wbt: Fix detection of dirty-throttled tasks") ba91c849fa50 ("blk-rq-qos: store a gendisk instead of request_queue in struct rq_qos") 3963d84df797 ("blk-rq-qos: constify rq_qos_ops")ce57b558604e ("blk-rq-qos: make rq_qos_add and rq_qos_del more useful") b494f9c566ba ("blk-rq-qos: move rq_qos_add and rq_qos_del out of line") de185b56e8a6 ("blk-cgroup: pass a gendisk to blkcg_schedule_throttle") 9df3e65139b9 ("blk-iocost: simplify ioc_name")14a6e2eb7df5 ("block: don't allow the same type rq_qos add more than once") 5cf9c91ba927 ("block: serialize all debugfs operations using q->debugfs_mutex") 8a177a36da6c ("blk-iolatency: Fix inflight count imbalances and IO hangs on offline") c97ab271576d ("blk-cgroup: remove unneeded includes from <linux/blk-cgroup.h>") 7f20ba7c42fd ("blk-cgroup: remove pointless CONFIG_BLOCK ifdefs") bbb1ebe7a909 ("blk-cgroup: replace bio_blkcg with bio_blkcg_css") dec223c92a46 ("blk-cgroup: move struct blkcg to block/blk-cgroup.h") 397c9f46ee4d ("blk-cgroup: move blkcg_{pin,unpin}_online out of line") 216889aad362 ("blk-cgroup: move blk_cgroup_congested out line") d589ae0d4460 ("Merge tag 'for-5.18/block-2022-04-01' of git://git.kernel.dk/linux-block")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f814bdda774c183b0cc15ec8f3b6e7c6f4527ba5 Mon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Tue, 23 Jan 2024 18:58:26 +0100
Subject: [PATCH] blk-wbt: Fix detection of dirty-throttled tasks
The detection of dirty-throttled tasks in blk-wbt has been subtly broken since its beginning in 2016. Namely if we are doing cgroup writeback and the throttled task is not in the root cgroup, balance_dirty_pages() will set dirty_sleep for the non-root bdi_writeback structure. However blk-wbt checks dirty_sleep only in the root cgroup bdi_writeback structure. Thus detection of recently throttled tasks is not working in this case (we noticed this when we switched to cgroup v2 and suddently writeback was slow).
Since blk-wbt has no easy way to get to proper bdi_writeback and furthermore its intention has always been to work on the whole device rather than on individual cgroups, just move the dirty_sleep timestamp from bdi_writeback to backing_dev_info. That fixes the checking for recently throttled task and saves memory for everybody as a bonus.
block/blk-wbt.c +2 -2
@@ -163,9 +163,9 @@ static void wb_timestamp(struct rq_wb *rwb, unsigned long *var)*/ static bool wb_recent_wait (struct rq_wb *rwb) { -struct bdi_writeback *wb = &rwb->rqos.disk->bdi->wb; +struct backing_dev_info *bdi = rwb->rqos.disk->bdi; -return time_before (jiffies, wb->dirty_sleep +HZ ); +return time_before (jiffies, bdi->last_bdp_sleep +HZ ); } static inline struct rq_wait *get_rq_wait(struct rq_wb *rwb,
include/linux/backing-dev-defs.h +5 -2
@@ -141,8 +141,6 @@ struct bdi_writeback {struct delayed_work dwork;/* work item used for writeback */ struct delayed_work bw_dwork;/* work item used for bandwidth estimate */ -unsigned long dirty_sleep;/* last wait */ -struct list_head bdi_node;/* anchored at bdi->wb_list */ #ifdef CONFIG_CGROUP_WRITEBACK
@@ -179,6 +177,11 @@ struct backing_dev_info {* any dirty wbs, which is depended upon by bdi_has_dirty(). */ atomic_long_t tot_write_bandwidth; +/* +* Jiffies when last process was dirty throttled on this bdi. Used by +* blk-wbt. +*/ +unsigned long last_bdp_sleep;struct bdi_writeback wb;/* the root writeback info for this bdi */ struct list_head wb_list;/* list of all wbs */
mm/backing-dev.c +1 -1
@@ -436,7 +436,6 @@ static int wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi,INIT_LIST_HEAD (&wb->work_list);INIT_DELAYED_WORK (&wb->dwork, wb_workfn);INIT_DELAYED_WORK (&wb->bw_dwork, wb_update_bandwidth_workfn); - wb->dirty_sleep = jiffies; err =fprop_local_init_percpu (&wb->completions, gfp);if (err)
@@ -921,6 +920,7 @@ int bdi_init(struct backing_dev_info *bdi)INIT_LIST_HEAD (&bdi->bdi_list);INIT_LIST_HEAD (&bdi->wb_list);init_waitqueue_head (&bdi->wb_waitq); + bdi->last_bdp_sleep = jiffies;return cgwb_bdi_init (bdi); }
mm/page-writeback.c +1 -1
@@ -1921,7 +1921,7 @@ static int balance_dirty_pages(struct bdi_writeback *wb,break ; }__set_current_state (TASK_KILLABLE ); - wb->dirty_sleep = now; + bdi->last_bdp_sleep = jiffies;io_schedule_timeout (pause); current->dirty_paused_when = now + pause;