[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1436172445-6979-19-git-send-email-avagin@openvz.org>
Date: Mon, 6 Jul 2015 11:47:19 +0300
From: Andrey Vagin <avagin@...nvz.org>
To: linux-kernel@...r.kernel.org
Cc: linux-api@...r.kernel.org, Andrey Vagin <avagin@...nvz.org>,
Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Pavel Emelyanov <xemul@...allels.com>,
Roger Luethi <rl@...lgate.ch>, Arnd Bergmann <arnd@...db.de>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
David Ahern <dsahern@...il.com>,
Andy Lutomirski <luto@...capital.net>,
Pavel Odintsov <pavel.odintsov@...il.com>
Subject: [PATCH 18/24] task_diag: add ability to handle one task in a continious mode
If a task has many vma-s, the size of information about them can be too
big to be placed into one skb.
Signed-off-by: Andrey Vagin <avagin@...nvz.org>
---
include/uapi/linux/task_diag.h | 1 +
kernel/taskdiag.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/uapi/linux/task_diag.h b/include/uapi/linux/task_diag.h
index e1d09e6..4a1cecb 100644
--- a/include/uapi/linux/task_diag.h
+++ b/include/uapi/linux/task_diag.h
@@ -151,6 +151,7 @@ static inline struct task_diag_vma_stat *task_diag_vma_stat(struct task_diag_vma
#define TASK_DIAG_DUMP_ALL 0
#define TASK_DIAG_DUMP_CHILDREN 1
#define TASK_DIAG_DUMP_THREAD 2
+#define TASK_DIAG_DUMP_ONE 3
struct task_diag_pid {
__u64 show_flags;
diff --git a/kernel/taskdiag.c b/kernel/taskdiag.c
index dc319bf..20494ee 100644
--- a/kernel/taskdiag.c
+++ b/kernel/taskdiag.c
@@ -559,6 +559,16 @@ static struct task_struct *iter_start(struct task_iter *iter)
}
switch (iter->req.dump_strategy) {
+ case TASK_DIAG_DUMP_ONE:
+ if (iter->parent == NULL)
+ return ERR_PTR(-ESRCH);
+ iter->pos = iter->cb->args[0];
+ if (iter->pos == 0) {
+ iter->task = iter->parent;
+ get_task_struct(iter->task);
+ } else
+ iter->task = NULL;
+ return iter->task;
case TASK_DIAG_DUMP_THREAD:
if (iter->parent == NULL)
return ERR_PTR(-ESRCH);
@@ -588,6 +598,13 @@ static struct task_struct *iter_start(struct task_iter *iter)
static struct task_struct *iter_next(struct task_iter *iter)
{
switch (iter->req.dump_strategy) {
+ case TASK_DIAG_DUMP_ONE:
+ iter->pos++;
+ iter->cb->args[0] = iter->pos;
+ if (iter->task)
+ put_task_struct(iter->task);
+ iter->task = NULL;
+ return NULL;
case TASK_DIAG_DUMP_THREAD:
iter->pos++;
iter->task = task_next_tid(iter->task);
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists