On Tue 14-10-25 17:38:34, Kundan Kumar wrote:
> Since we have multiple cgwb per bdi, embedded in writeback_ctx now, we
> iterate over all of them to find the associated writeback.
> 
> Signed-off-by: Kundan Kumar <[email protected]>
> Signed-off-by: Anuj Gupta <[email protected]>
> ---
>  fs/fs-writeback.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 56c048e22f72..93f8ea340247 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -1090,7 +1090,8 @@ int cgroup_writeback_by_id(u64 bdi_id, int memcg_id,
>  {
>       struct backing_dev_info *bdi;
>       struct cgroup_subsys_state *memcg_css;
> -     struct bdi_writeback *wb;
> +     struct bdi_writeback *wb = NULL;
> +     struct bdi_writeback_ctx *bdi_wb_ctx;
>       struct wb_writeback_work *work;
>       unsigned long dirty;
>       int ret;
> @@ -1114,7 +1115,11 @@ int cgroup_writeback_by_id(u64 bdi_id, int memcg_id,
>        * And find the associated wb.  If the wb isn't there already
>        * there's nothing to flush, don't create one.
>        */
> -     wb = wb_get_lookup(bdi->wb_ctx[0], memcg_css);
> +     for_each_bdi_wb_ctx(bdi, bdi_wb_ctx) {
> +             wb = wb_get_lookup(bdi_wb_ctx, memcg_css);
> +             if (wb)
> +                     break;
> +     }

This is wrong. We need to run writeback for all bdi_writeback structures
for given memcg_css. Not just for the one we found first. Otherwise
cgroup_writeback_by_id() wouldn't properly relieve the dirty pages pressure
from a foreign dirtying of a memcg (see the big comment before
mem_cgroup_track_foreign_dirty_slowpath() for more background on why
cgroup_writeback_by_id() exists).

                                                                Honza
-- 
Jan Kara <[email protected]>
SUSE Labs, CR


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to