| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in long time. And the daemon was killed by an OOM killer. So the
daemon has memory leak. This patch fixes this problem.
The daemon allocates memory at cg_prepare_cgroup(), but it does not
free the memory. This patch adds necessary free() to cgroup_change_
cgroup_path by calling cgroup_free_controllers(). In addition, this
patch adds free()s for handling error and flushes the counters of the
allocations in cgroup_free_controllers().
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
|
|
|
|
|
|
|
|
|
| |
Add a new API to iterate through the tasks file to get
the list of all the tasks in a cgroup.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
gcc -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -Wall -MT api.lo -MD -MP -MF .deps/api.Tpo -c api.c -fPIC -DPIC -o .libs/api.o
api.c:52:1: warning: "VERSION" redefined
In file included from ./libcgroup-internal.h:21,
from api.c:31:
../config.h:129:1: warning: this is the location of the previous definition
api.c: In function 'cgroup_parse_rules':
api.c:353: warning: implicit declaration of function 'isblank'
api.c: In function 'cgroup_modify_cgroup':
api.c:1073: warning: implicit declaration of function 'asprintf'
This patch fixes the warning arising due to isblank, asprintf and getline.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Two pthread_rwlock_unlock() calls are necessary if *cgroup is null
and fprintf()/fflush() fails in cgroup_attach_task_pid():
src/api.c:785
785 pthread_rwlock_rdlock(&cg_mount_table_lock);
786 for(i = 0; i < CG_CONTROLLER_MAX &&
787 cg_mount_table[i].name[0]!='\0'; i++) {
[snip]
805 ret = fprintf(tasks, "%d", tid);
806 if (ret < 0) {
<<pthread_rwlock_unlock() call is necessary>>
807 cgroup_dbg("Error writing tid %d to
%s:%s\n",
808 tid, path,
strerror(errno));
809 fclose(tasks);
810 last_errno = errno;
811 return ECGOTHER;
812 }
813
814 ret = fflush(tasks);
815 if (ret) {
<<pthread_rwlock_unlock() call is necessary>>
816 last_errno = errno;
817 cgroup_dbg("Error writing tid %d to
%s:%s\n",
818 tid, path,
strerror(errno));
819 fclose(tasks);
820 return ECGOTHER;
821 }
For the readability, this patch merges almost the same lines into one
function(__cgroup_attach_task_pid()) and adds pthread_rwlock_unlock()
call for the case the function fails.
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
specific stats. Added Makefile.am updates which I had missed in the
previous post.
New APIs to read controller specific statistics.
This patch introduces 3 new APIs which can be used to read controller
statistics iteratively. (Eg. stats from memory.stat etc)
Reading of stats is initiated by cgroup_read_stats_begin() API, which
returns the first stat of the requested controller in addition to returing
a handle that should be used in subsequent reads.
cgroup_read_stats_next() API can be used to read the remaining stats
one by one. This needs the handle returned by cgroup_read_stats_begin().
cgroup_read_stats_end() API will terminate the stats reading iteration
initiated by cgroup_read_stats_begin().
Changelog:
v2
- Update tests/Makefile.am so that it generates appropriate rules
for tests/read_stats.c in the Makefile. This is in addition to
the manual updates done to the generated file tests/Makefile.in.
v1
- cgroup_read_stats apis now work with relative cgroup path names instead
of absolute path names.
v0
- Initial post.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
|
|
|
|
|
|
|
|
|
| |
I reviewed the libcgroup code in the viewpoint of memory-leak and
found a lack of free(). This patch adds a free() call for error
handling.
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
|
|
|
|
|
|
|
|
|
| |
I reviewed the libcgroup code in the viewpoint of memory-leak and
found some lacks of fclose(). This patch adds some fclose() calls
for error handling.
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
|
|
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
|