o Add an option cgroup_nodelete to not remove cgroups created by fio after
the job completion. This can help a user in inspecting various cgroup
files after fio job completion.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
the documentation that comes with the kernel, allowed values
are in the range of 100..1000.
the documentation that comes with the kernel, allowed values
are in the range of 100..1000.
+cgroup_nodelete=bool Normally fio will delete the cgroups it has created after
+ the job completion. To override this behavior and to leave
+ cgroups around after the job completion, set cgroup_nodelete=1.
+ This can be useful if one wants to inspect various cgroup
+ files after job completion. Default: false
+
uid=int Instead of running as the invoking user, set the user ID to
this value before the thread/process does any work.
uid=int Instead of running as the invoking user, set the user ID to
this value before the thread/process does any work.
struct cgroup_member {
struct flist_head list;
char *root;
struct cgroup_member {
struct flist_head list;
char *root;
+ unsigned int cgroup_nodelete;
};
static char *find_cgroup_mnt(struct thread_data *td)
};
static char *find_cgroup_mnt(struct thread_data *td)
-static void add_cgroup(const char *name, struct flist_head *clist)
+static void add_cgroup(struct thread_data *td, const char *name,
+ struct flist_head *clist)
{
struct cgroup_member *cm;
cm = smalloc(sizeof(*cm));
INIT_FLIST_HEAD(&cm->list);
cm->root = smalloc_strdup(name);
{
struct cgroup_member *cm;
cm = smalloc(sizeof(*cm));
INIT_FLIST_HEAD(&cm->list);
cm->root = smalloc_strdup(name);
+ if (td->o.cgroup_nodelete)
+ cm->cgroup_nodelete = 1;
fio_mutex_down(lock);
flist_add_tail(&cm->list, clist);
fio_mutex_up(lock);
fio_mutex_down(lock);
flist_add_tail(&cm->list, clist);
fio_mutex_up(lock);
flist_for_each_safe(n, tmp, clist) {
cm = flist_entry(n, struct cgroup_member, list);
flist_for_each_safe(n, tmp, clist) {
cm = flist_entry(n, struct cgroup_member, list);
+ if (!cm->cgroup_nodelete)
+ rmdir(cm->root);
flist_del(&cm->list);
sfree(cm->root);
sfree(cm);
flist_del(&cm->list);
sfree(cm->root);
sfree(cm);
- add_cgroup(root, clist);
+ add_cgroup(td, root, clist);
if (td->o.cgroup_weight) {
if (write_int_to_file(td, root, "blkio.weight",
if (td->o.cgroup_weight) {
if (write_int_to_file(td, root, "blkio.weight",
Set the weight of the cgroup to this value. See the documentation that comes
with the kernel, allowed values are in the range of 100..1000.
.TP
Set the weight of the cgroup to this value. See the documentation that comes
with the kernel, allowed values are in the range of 100..1000.
.TP
+.BI cgroup_nodelete \fR=\fPbool
+Normally fio will delete the cgroups it has created after the job completion.
+To override this behavior and to leave cgroups around after the job completion,
+set cgroup_nodelete=1. This can be useful if one wants to inspect various
+cgroup files after job completion. Default: false
+.TP
.BI uid \fR=\fPint
Instead of running as the invoking user, set the user ID to this value before
the thread/process does any work.
.BI uid \fR=\fPint
Instead of running as the invoking user, set the user ID to this value before
the thread/process does any work.
*/
char *cgroup;
unsigned int cgroup_weight;
*/
char *cgroup;
unsigned int cgroup_weight;
+ unsigned int cgroup_nodelete;
unsigned int uid;
unsigned int gid;
unsigned int uid;
unsigned int gid;
.minval = 100,
.maxval = 1000,
},
.minval = 100,
.maxval = 1000,
},
+ {
+ .name = "cgroup_nodelete",
+ .type = FIO_OPT_BOOL,
+ .off1 = td_var_offset(cgroup_nodelete),
+ .help = "Do not delete cgroups after job completion",
+ .def = "0",
+ },
{
.name = "uid",
.type = FIO_OPT_INT,
{
.name = "uid",
.type = FIO_OPT_INT,