* [PATCH] block/blk-cgroup.c: free per-blkcg data when freeing the blkcg
@ 2015-07-07 1:08 Arianna Avanzini
2015-07-07 13:49 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Arianna Avanzini @ 2015-07-07 1:08 UTC (permalink / raw)
To: linux-kernel; +Cc: axboe, kaminsky, avanzini.arianna
Currently, per-blkcg data is freed each time a policy is deactivated,
that is also upon scheduler switch. However, when switching from a
scheduler implementing a policy which requires per-blkcg data to
another one, that same policy might be active on other devices, and
therefore those same per-blkcg data could be still in use.
This commit lets per-blkcg data be freed when the blkcg is freed
instead of on policy deactivation.
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Reported-and-tested-by: Michael Kaminsky <kaminsky@cs.cmu.edu>
Fixes: e48453c3 ("block, cgroup: implement policy-specific per-blkcg data")
---
block/blk-cgroup.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 9f97da5..5e2723f 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -822,8 +822,13 @@ static void blkcg_css_free(struct cgroup_subsys_state *css)
{
struct blkcg *blkcg = css_to_blkcg(css);
- if (blkcg != &blkcg_root)
+ if (blkcg != &blkcg_root) {
+ int i;
+
+ for (i = 0; i < BLKCG_MAX_POLS; i++)
+ kfree(blkcg->pd[i]);
kfree(blkcg);
+ }
}
static struct cgroup_subsys_state *
@@ -1162,8 +1167,6 @@ void blkcg_deactivate_policy(struct request_queue *q,
kfree(blkg->pd[pol->plid]);
blkg->pd[pol->plid] = NULL;
- kfree(blkg->blkcg->pd[pol->plid]);
- blkg->blkcg->pd[pol->plid] = NULL;
spin_unlock(&blkg->blkcg->lock);
}
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block/blk-cgroup.c: free per-blkcg data when freeing the blkcg
2015-07-07 1:08 [PATCH] block/blk-cgroup.c: free per-blkcg data when freeing the blkcg Arianna Avanzini
@ 2015-07-07 13:49 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2015-07-07 13:49 UTC (permalink / raw)
To: Arianna Avanzini, linux-kernel; +Cc: kaminsky
On 07/06/2015 07:08 PM, Arianna Avanzini wrote:
> Currently, per-blkcg data is freed each time a policy is deactivated,
> that is also upon scheduler switch. However, when switching from a
> scheduler implementing a policy which requires per-blkcg data to
> another one, that same policy might be active on other devices, and
> therefore those same per-blkcg data could be still in use.
> This commit lets per-blkcg data be freed when the blkcg is freed
> instead of on policy deactivation.
>
> Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
> Reported-and-tested-by: Michael Kaminsky <kaminsky@cs.cmu.edu>
> Fixes: e48453c3 ("block, cgroup: implement policy-specific per-blkcg data")
Thanks Arianna, applied! Hopefully this is the end of the per-policy
data issues for 4.2.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-07 13:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-07 1:08 [PATCH] block/blk-cgroup.c: free per-blkcg data when freeing the blkcg Arianna Avanzini
2015-07-07 13:49 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox