mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
cgroup: Implement blkio.weight tuning API.
Implement blkio.weight tuning API. Acked-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
This commit is contained in:
parent
b58241a690
commit
c3658ab543
@ -66,6 +66,7 @@ virCgroupDenyDevicePath;
|
|||||||
virCgroupForDomain;
|
virCgroupForDomain;
|
||||||
virCgroupForDriver;
|
virCgroupForDriver;
|
||||||
virCgroupFree;
|
virCgroupFree;
|
||||||
|
virCgroupGetBlkioWeight;
|
||||||
virCgroupGetCpuShares;
|
virCgroupGetCpuShares;
|
||||||
virCgroupGetCpuacctUsage;
|
virCgroupGetCpuacctUsage;
|
||||||
virCgroupGetFreezerState;
|
virCgroupGetFreezerState;
|
||||||
@ -75,6 +76,7 @@ virCgroupGetMemoryUsage;
|
|||||||
virCgroupGetSwapHardLimit;
|
virCgroupGetSwapHardLimit;
|
||||||
virCgroupMounted;
|
virCgroupMounted;
|
||||||
virCgroupRemove;
|
virCgroupRemove;
|
||||||
|
virCgroupSetBlkioWeight;
|
||||||
virCgroupSetCpuShares;
|
virCgroupSetCpuShares;
|
||||||
virCgroupSetFreezerState;
|
virCgroupSetFreezerState;
|
||||||
virCgroupSetMemory;
|
virCgroupSetMemory;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* cgroup.c: Tools for managing cgroups
|
* cgroup.c: Tools for managing cgroups
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat, Inc.
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||||
* Copyright IBM Corp. 2008
|
* Copyright IBM Corp. 2008
|
||||||
*
|
*
|
||||||
* See COPYING.LIB for the License of this software
|
* See COPYING.LIB for the License of this software
|
||||||
@ -850,6 +850,45 @@ int virCgroupForDomain(virCgroupPtr driver ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virCgroupSetBlkioWeight:
|
||||||
|
*
|
||||||
|
* @group: The cgroup to change io weight for
|
||||||
|
* @weight: The Weight for this cgroup
|
||||||
|
*
|
||||||
|
* Returns: 0 on success
|
||||||
|
*/
|
||||||
|
int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int weight)
|
||||||
|
{
|
||||||
|
if (weight > 1000 || weight < 100)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
return virCgroupSetValueU64(group,
|
||||||
|
VIR_CGROUP_CONTROLLER_BLKIO,
|
||||||
|
"blkio.weight",
|
||||||
|
weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virCgroupGetBlkioWeight:
|
||||||
|
*
|
||||||
|
* @group: The cgroup to get weight for
|
||||||
|
* @Weight: Pointer to returned weight
|
||||||
|
*
|
||||||
|
* Returns: 0 on success
|
||||||
|
*/
|
||||||
|
int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight)
|
||||||
|
{
|
||||||
|
unsigned long long tmp;
|
||||||
|
int ret;
|
||||||
|
ret = virCgroupGetValueU64(group,
|
||||||
|
VIR_CGROUP_CONTROLLER_BLKIO,
|
||||||
|
"blkio.weight", &tmp);
|
||||||
|
if (ret == 0)
|
||||||
|
*weight = tmp;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virCgroupSetMemory:
|
* virCgroupSetMemory:
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* cgroup.h: Interface to tools for managing cgroups
|
* cgroup.h: Interface to tools for managing cgroups
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 2011 Red Hat, Inc.
|
||||||
* Copyright IBM Corp. 2008
|
* Copyright IBM Corp. 2008
|
||||||
*
|
*
|
||||||
* See COPYING.LIB for the License of this software
|
* See COPYING.LIB for the License of this software
|
||||||
@ -41,6 +42,9 @@ int virCgroupForDomain(virCgroupPtr driver,
|
|||||||
|
|
||||||
int virCgroupAddTask(virCgroupPtr group, pid_t pid);
|
int virCgroupAddTask(virCgroupPtr group, pid_t pid);
|
||||||
|
|
||||||
|
int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int weight);
|
||||||
|
int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight);
|
||||||
|
|
||||||
int virCgroupSetMemory(virCgroupPtr group, unsigned long long kb);
|
int virCgroupSetMemory(virCgroupPtr group, unsigned long long kb);
|
||||||
int virCgroupGetMemoryUsage(virCgroupPtr group, unsigned long *kb);
|
int virCgroupGetMemoryUsage(virCgroupPtr group, unsigned long *kb);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user