From: Kirill Korotaev <dev@openvz.org>
To: Kirill Korotaev <dev@openvz.org>
Cc: serue@us.ibm.com, arjan@infradead.org, frankeh@watson.ibm.com,
clg@fr.ibm.com, haveblue@us.ibm.com, mrmacman_g4@mac.com,
alan@lxorguk.ukuu.org.uk,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
devel@openvz.org
Subject: [RFC][PATCH 7/7] VPIDs: required VPS interface for VPIDs
Date: Thu, 02 Feb 2006 19:33:20 +0300 [thread overview]
Message-ID: <43E23450.7080208@openvz.org> (raw)
In-Reply-To: <43E22B2D.1040607@openvz.org>
[-- Attachment #1: Type: text/plain, Size: 78 bytes --]
This patch adds small VPS/containers interface which is used by VPIDs
Kirill
[-- Attachment #2: diff-vps-info --]
[-- Type: text/plain, Size: 3538 bytes --]
--- ./include/linux/sched.h.vps_info 2006-02-02 14:58:53.000000000 +0300
+++ ./include/linux/sched.h 2006-02-02 18:38:15.134903248 +0300
@@ -15,6 +15,7 @@
#include <linux/cpumask.h>
#include <linux/errno.h>
#include <linux/nodemask.h>
+#include <linux/vps_info.h>
#include <asm/system.h>
#include <asm/semaphore.h>
--- ./include/linux/vps_info.h.vps_info 2006-02-02 18:12:49.500834880 +0300
+++ ./include/linux/vps_info.h 2006-02-02 18:55:41.137886624 +0300
@@ -0,0 +1,44 @@
+#ifndef __VPS_INFO_H_
+#define __VPS_INFO_H_
+
+#include <linux/config.h>
+
+struct vps_common_info {
+ int id;
+ struct task_struct *init_task;
+ int is_sparse;
+ atomic_t counter;
+ atomic_t pcounter;
+};
+
+typedef struct vps_common_info *vps_info_t;
+
+#ifndef CONFIG_VPS
+extern struct vps_common_info super_vps_info;
+
+#define super_vps() (&super_vps_info)
+#define current_vps() (super_vps())
+#define task_vps(t) (super_vps())
+#define inside_vps() (0)
+#define task_inside_vps(t) (0)
+#define vps_stop(vps) do { } while (0)
+#define vps_free(vps) do { } while (0)
+#endif
+
+#define sparse_vpid(vps) ((vps)->is_sparse)
+#define set_sparse_vpid(vps) do { (vps)->is_sparse = 1; } while (0)
+
+#define vps_get(vps) atomic_inc(&(vps)->counter)
+#define vps_put(vps) do { \
+ if (atomic_dec_and_test(&(vps)->counter)) \
+ vps_free(vps); \
+ } while (0)
+
+#define vps_task_add(vps) atomic_inc(&(vps)->pcounter)
+#define vps_task_del(vps) do { \
+ if (atomic_dec_and_test(&(vps)->pcounter)) \
+ vps_stop(vps); \
+ } while (0)
+#define get_vps_tasks_num(vps) atomic_read(&(vps)->pcounter)
+
+#endif
--- ./init/main.c.vps_info 2006-02-02 14:15:35.000000000 +0300
+++ ./init/main.c 2006-02-02 18:40:36.592398440 +0300
@@ -47,6 +47,7 @@
#include <linux/rmap.h>
#include <linux/mempolicy.h>
#include <linux/key.h>
+#include <linux/vps_info.h>
#include <asm/io.h>
#include <asm/bugs.h>
@@ -434,6 +435,14 @@ void __init parse_early_param(void)
done = 1;
}
+struct vps_common_info super_vps_info = {
+ .id = 0,
+ .init_task = &init_task,
+ .counter = ATOMIC_INIT(1),
+ .pcounter = ATOMIC_INIT(1), /* init_task */
+ .is_sparse = 0,
+};
+
/*
* Activate the first processor.
*/
--- ./kernel/exit.c.vps_info 2006-02-02 14:33:58.000000000 +0300
+++ ./kernel/exit.c 2006-02-02 18:33:10.953145904 +0300
@@ -31,6 +31,7 @@
#include <linux/signal.h>
#include <linux/cn_proc.h>
#include <linux/mutex.h>
+#include <linux/vps_info.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
@@ -107,6 +108,7 @@ repeat:
spin_unlock(&p->proc_lock);
proc_pid_flush(proc_dentry);
release_thread(p);
+ vps_task_del(task_vps(p));
put_task_struct(p);
p = leader;
--- ./kernel/fork.c.vps_info 2006-02-02 14:41:40.000000000 +0300
+++ ./kernel/fork.c 2006-02-02 18:32:07.910729808 +0300
@@ -44,6 +44,7 @@
#include <linux/rmap.h>
#include <linux/acct.h>
#include <linux/cn_proc.h>
+#include <linux/vps_info.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
@@ -1139,6 +1140,7 @@ static task_t *copy_process(unsigned lon
p->ioprio = current->ioprio;
SET_LINKS(p);
+ vps_task_add(task_vps(p));
if (unlikely(p->ptrace & PT_PTRACED))
__ptrace_link(p, current->parent);
--- ./kernel/pid.c.vps_info 2006-02-02 14:58:34.000000000 +0300
+++ ./kernel/pid.c 2006-02-02 18:54:25.506384360 +0300
@@ -26,6 +26,7 @@
#include <linux/init.h>
#include <linux/bootmem.h>
#include <linux/hash.h>
+#include <linux/vps_info.h>
#ifdef CONFIG_VIRTUAL_PIDS
static void __free_vpid(int vpid, struct task_struct *ve_tsk);
next prev parent reply other threads:[~2006-02-02 16:31 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-02 15:54 [RFC][PATCH] VPIDs: Virtualization of PIDs (OpenVZ approach) Kirill Korotaev
2006-02-02 16:16 ` [RFC][PATCH 1/7] VPIDs: add VPID config option Kirill Korotaev
2006-02-02 16:21 ` [RFC][PATCH 2/7] VPIDs: pid/vpid conversions Kirill Korotaev
2006-02-08 20:29 ` Eric W. Biederman
2006-02-08 23:53 ` Alexey Kuznetsov
2006-02-09 0:37 ` Eric W. Biederman
2006-02-09 1:11 ` Alexey Kuznetsov
2006-02-09 1:36 ` Eric W. Biederman
2006-02-09 2:51 ` Serge E. Hallyn
2006-02-09 9:55 ` Alexey Kuznetsov
2006-02-09 19:22 ` Eric W. Biederman
2006-02-20 14:57 ` Kirill Korotaev
2006-02-20 16:56 ` Herbert Poetzl
2006-02-21 16:19 ` Kirill Korotaev
2006-02-21 23:17 ` Herbert Poetzl
2006-02-02 16:24 ` [RFC][PATCH 3/7] VPIDs: fork modifications Kirill Korotaev
2006-02-02 20:08 ` Cedric Le Goater
2006-02-02 16:26 ` [RFC][PATCH 4/7] VPIDs: vpid macros in non-VPID case Kirill Korotaev
2006-02-02 16:30 ` [RFC][PATCH 5/7] VPIDs: vpid/pid conversion in VPID enabled case Kirill Korotaev
2006-02-02 17:05 ` Dave Hansen
2006-02-02 19:29 ` Serge E. Hallyn
2006-02-03 10:52 ` Alexey Kuznetsov
2006-02-03 12:48 ` Cedric Le Goater
2006-02-03 14:02 ` Alexey Kuznetsov
2006-02-03 16:25 ` Dave Hansen
2006-02-06 11:24 ` Alexey Kuznetsov
2006-02-03 17:05 ` Cedric Le Goater
2006-02-06 9:48 ` Alexey Kuznetsov
2006-02-06 14:51 ` Serge E. Hallyn
2006-02-06 15:51 ` Alexey Kuznetsov
2006-02-06 16:24 ` Serge E. Hallyn
2006-02-07 9:46 ` Cedric Le Goater
2006-02-07 11:44 ` Kirill Korotaev
2006-02-07 12:59 ` Cedric Le Goater
2006-02-07 9:15 ` Cedric Le Goater
2006-02-03 14:05 ` Kirill Korotaev
2006-02-03 15:40 ` Cedric Le Goater
2006-02-03 16:28 ` Kirill Korotaev
2006-02-02 16:31 ` [RFC][PATCH 6/7] VPIDs: small proc VPID export Kirill Korotaev
2006-02-02 16:33 ` Kirill Korotaev [this message]
2006-02-03 3:01 ` [RFC][PATCH] VPIDs: Virtualization of PIDs (OpenVZ approach) Herbert Poetzl
2006-02-03 10:30 ` Kirill Korotaev
2006-02-03 12:45 ` Alexey Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43E23450.7080208@openvz.org \
--to=dev@openvz.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arjan@infradead.org \
--cc=clg@fr.ibm.com \
--cc=devel@openvz.org \
--cc=frankeh@watson.ibm.com \
--cc=haveblue@us.ibm.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mrmacman_g4@mac.com \
--cc=serue@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox