diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/fs/proc/loadavg.c linux-2.6.31.5-vs2.3.0.36.21.4/fs/proc/loadavg.c --- linux-2.6.31.5-vs2.3.0.36.21.3/fs/proc/loadavg.c 2009-09-10 16:58:00.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/fs/proc/loadavg.c 2009-11-05 04:12:09.000000000 +0100 @@ -19,7 +19,7 @@ static int loadavg_proc_show(struct seq_ get_avenrun(avnrun, FIXED_1/200, 0); if (vx_flags(VXF_VIRT_LOAD, 0)) { - struct vx_info *vxi = current->vx_info; + struct vx_info *vxi = current_vx_info(); running = atomic_read(&vxi->cvirt.nr_running); threads = atomic_read(&vxi->cvirt.nr_threads); diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/include/linux/vserver/base.h linux-2.6.31.5-vs2.3.0.36.21.4/include/linux/vserver/base.h --- linux-2.6.31.5-vs2.3.0.36.21.3/include/linux/vserver/base.h 2009-11-05 03:48:10.000000000 +0100 +++ linux-2.6.31.5-vs2.3.0.36.21.4/include/linux/vserver/base.h 2009-11-05 04:16:31.000000000 +0100 @@ -43,7 +43,7 @@ enum { #define __vx_flags(v) ((v) ? (v)->vx_flags : 0) -#define vx_current_flags() __vx_flags(current->vx_info) +#define vx_current_flags() __vx_flags(current_vx_info()) #define vx_info_flags(v, m, f) \ vs_check_flags(__vx_flags(v), m, f) @@ -51,18 +51,18 @@ enum { #define task_vx_flags(t, m, f) \ ((t) && vx_info_flags((t)->vx_info, m, f)) -#define vx_flags(m, f) vx_info_flags(current->vx_info, m, f) +#define vx_flags(m, f) vx_info_flags(current_vx_info(), m, f) /* context caps */ #define __vx_ccaps(v) ((v) ? (v)->vx_ccaps : 0) -#define vx_current_ccaps() __vx_ccaps(current->vx_info) +#define vx_current_ccaps() __vx_ccaps(current_vx_info()) #define vx_info_ccaps(v, c) (__vx_ccaps(v) & (c)) -#define vx_ccaps(c) vx_info_ccaps(current->vx_info, (c)) +#define vx_ccaps(c) vx_info_ccaps(current_vx_info(), (c)) @@ -98,28 +98,28 @@ enum { #define vx_info_mcaps(v, c) (__vx_mcaps(v) & (c)) -#define vx_mcaps(c) vx_info_mcaps(current->vx_info, c) +#define vx_mcaps(c) vx_info_mcaps(current_vx_info(), c) /* context bcap mask */ #define __vx_bcaps(v) ((v)->vx_bcaps) -#define vx_current_bcaps() __vx_bcaps(current->vx_info) +#define vx_current_bcaps() __vx_bcaps(current_vx_info()) /* mask given bcaps */ #define vx_info_mbcaps(v, c) ((v) ? cap_intersect(__vx_bcaps(v), c) : c) -#define vx_mbcaps(c) vx_info_mbcaps(current->vx_info, c) +#define vx_mbcaps(c) vx_info_mbcaps(current_vx_info(), c) /* masked cap_bset */ #define vx_info_cap_bset(v) vx_info_mbcaps(v, current->cap_bset) -#define vx_current_cap_bset() vx_info_cap_bset(current->vx_info) +#define vx_current_cap_bset() vx_info_cap_bset(current_vx_info()) #if 0 #define vx_info_mbcap(v, b) \ diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/include/linux/vserver/pid.h linux-2.6.31.5-vs2.3.0.36.21.4/include/linux/vserver/pid.h --- linux-2.6.31.5-vs2.3.0.36.21.3/include/linux/vserver/pid.h 2009-09-10 16:11:43.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/include/linux/vserver/pid.h 2009-11-05 04:17:16.000000000 +0100 @@ -6,7 +6,7 @@ #define vx_info_map_pid(v, p) \ __vx_info_map_pid((v), (p), __func__, __FILE__, __LINE__) #define vx_info_map_tgid(v,p) vx_info_map_pid(v,p) -#define vx_map_pid(p) vx_info_map_pid(current->vx_info, p) +#define vx_map_pid(p) vx_info_map_pid(current_vx_info(), p) #define vx_map_tgid(p) vx_map_pid(p) static inline int __vx_info_map_pid(struct vx_info *vxi, int pid, @@ -28,7 +28,7 @@ static inline int __vx_info_map_pid(stru #define vx_info_rmap_pid(v, p) \ __vx_info_rmap_pid((v), (p), __func__, __FILE__, __LINE__) -#define vx_rmap_pid(p) vx_info_rmap_pid(current->vx_info, p) +#define vx_rmap_pid(p) vx_info_rmap_pid(current_vx_info(), p) #define vx_rmap_tgid(p) vx_rmap_pid(p) static inline int __vx_info_rmap_pid(struct vx_info *vxi, int pid, diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/include/linux/vs_limit.h linux-2.6.31.5-vs2.3.0.36.21.4/include/linux/vs_limit.h --- linux-2.6.31.5-vs2.3.0.36.21.3/include/linux/vs_limit.h 2009-09-10 16:11:43.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/include/linux/vs_limit.h 2009-11-05 04:14:38.000000000 +0100 @@ -13,7 +13,7 @@ __vx_acc_cres(v, r, d, p, __FILE__, __LINE__) #define vx_acc_cres_cond(x, d, p, r) \ - __vx_acc_cres(((x) == vx_current_xid()) ? current->vx_info : 0, \ + __vx_acc_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \ r, d, p, __FILE__, __LINE__) @@ -22,7 +22,7 @@ #define vx_sub_cres(v, a, p, r) vx_add_cres(v, -(a), p, r) #define vx_add_cres_cond(x, a, p, r) \ - __vx_add_cres(((x) == vx_current_xid()) ? current->vx_info : 0, \ + __vx_add_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \ r, a, p, __FILE__, __LINE__) #define vx_sub_cres_cond(x, a, p, r) vx_add_cres_cond(x, -(a), p, r) @@ -48,10 +48,10 @@ vx_acc_cres_cond((l)->fl_xid,-1, l, RLIMIT_LOCKS) #define vx_openfd_inc(f) \ - vx_acc_cres(current->vx_info, 1, (void *)(long)(f), VLIMIT_OPENFD) + vx_acc_cres(current_vx_info(), 1, (void *)(long)(f), VLIMIT_OPENFD) #define vx_openfd_dec(f) \ - vx_acc_cres(current->vx_info,-1, (void *)(long)(f), VLIMIT_OPENFD) + vx_acc_cres(current_vx_info(),-1, (void *)(long)(f), VLIMIT_OPENFD) #define vx_cres_avail(v, n, r) \ @@ -59,32 +59,32 @@ #define vx_nproc_avail(n) \ - vx_cres_avail(current->vx_info, n, RLIMIT_NPROC) + vx_cres_avail(current_vx_info(), n, RLIMIT_NPROC) #define vx_files_avail(n) \ - vx_cres_avail(current->vx_info, n, RLIMIT_NOFILE) + vx_cres_avail(current_vx_info(), n, RLIMIT_NOFILE) #define vx_locks_avail(n) \ - vx_cres_avail(current->vx_info, n, RLIMIT_LOCKS) + vx_cres_avail(current_vx_info(), n, RLIMIT_LOCKS) #define vx_openfd_avail(n) \ - vx_cres_avail(current->vx_info, n, VLIMIT_OPENFD) + vx_cres_avail(current_vx_info(), n, VLIMIT_OPENFD) /* dentry limits */ #define vx_dentry_inc(d) do { \ if (atomic_read(&d->d_count) == 1) \ - vx_acc_cres(current->vx_info, 1, d, VLIMIT_DENTRY); \ + vx_acc_cres(current_vx_info(), 1, d, VLIMIT_DENTRY); \ } while (0) #define vx_dentry_dec(d) do { \ if (atomic_read(&d->d_count) == 0) \ - vx_acc_cres(current->vx_info,-1, d, VLIMIT_DENTRY); \ + vx_acc_cres(current_vx_info(),-1, d, VLIMIT_DENTRY); \ } while (0) #define vx_dentry_avail(n) \ - vx_cres_avail(current->vx_info, n, VLIMIT_DENTRY) + vx_cres_avail(current_vx_info(), n, VLIMIT_DENTRY) /* socket limits */ @@ -96,7 +96,7 @@ vx_acc_cres((s)->sk_vx_info,-1, s, VLIMIT_NSOCK) #define vx_sock_avail(n) \ - vx_cres_avail(current->vx_info, n, VLIMIT_NSOCK) + vx_cres_avail(current_vx_info(), n, VLIMIT_NSOCK) /* ipc resource limits */ @@ -122,17 +122,17 @@ #define vx_semary_inc(a) \ - vx_acc_cres(current->vx_info, 1, a, VLIMIT_SEMARY) + vx_acc_cres(current_vx_info(), 1, a, VLIMIT_SEMARY) #define vx_semary_dec(a) \ - vx_acc_cres(current->vx_info, -1, a, VLIMIT_SEMARY) + vx_acc_cres(current_vx_info(), -1, a, VLIMIT_SEMARY) #define vx_nsems_add(a,n) \ - vx_add_cres(current->vx_info, n, a, VLIMIT_NSEMS) + vx_add_cres(current_vx_info(), n, a, VLIMIT_NSEMS) #define vx_nsems_sub(a,n) \ - vx_sub_cres(current->vx_info, n, a, VLIMIT_NSEMS) + vx_sub_cres(current_vx_info(), n, a, VLIMIT_NSEMS) #else diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/ipc/shm.c linux-2.6.31.5-vs2.3.0.36.21.4/ipc/shm.c --- linux-2.6.31.5-vs2.3.0.36.21.3/ipc/shm.c 2009-09-29 17:02:58.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/ipc/shm.c 2009-11-05 04:17:37.000000000 +0100 @@ -357,7 +357,7 @@ static int newseg(struct ipc_namespace * if (ns->shm_tot + numpages > ns->shm_ctlall) return -ENOSPC; - if (!vx_ipcshm_avail(current->vx_info, numpages)) + if (!vx_ipcshm_avail(current_vx_info(), numpages)) return -ENOSPC; shp = ipc_rcu_alloc(sizeof(*shp)); @@ -419,7 +419,7 @@ static int newseg(struct ipc_namespace * ns->shm_tot += numpages; error = shp->shm_perm.id; shm_unlock(shp); - vx_ipcshm_add(current->vx_info, key, numpages); + vx_ipcshm_add(current_vx_info(), key, numpages); return error; no_id: diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/kernel/fork.c linux-2.6.31.5-vs2.3.0.36.21.4/kernel/fork.c --- linux-2.6.31.5-vs2.3.0.36.21.3/kernel/fork.c 2009-11-05 03:48:49.000000000 +0100 +++ linux-2.6.31.5-vs2.3.0.36.21.4/kernel/fork.c 2009-11-05 04:17:43.000000000 +0100 @@ -996,7 +996,7 @@ static struct task_struct *copy_process( DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled); DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled); #endif - init_vx_info(&p->vx_info, current->vx_info); + init_vx_info(&p->vx_info, current_vx_info()); init_nx_info(&p->nx_info, current_nx_info()); /* check vserver memory */ diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/kernel/sched.c linux-2.6.31.5-vs2.3.0.36.21.4/kernel/sched.c --- linux-2.6.31.5-vs2.3.0.36.21.3/kernel/sched.c 2009-10-06 04:39:14.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/kernel/sched.c 2009-11-05 04:17:49.000000000 +0100 @@ -3214,7 +3214,7 @@ EXPORT_SYMBOL(avenrun); void get_avenrun(unsigned long *loads, unsigned long offset, int shift) { if (vx_flags(VXF_VIRT_LOAD, 0)) { - struct vx_info *vxi = current->vx_info; + struct vx_info *vxi = current_vx_info(); loads[0] = (vxi->cvirt.load[0] + offset) << shift; loads[1] = (vxi->cvirt.load[1] + offset) << shift; diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/kernel/vserver/context.c linux-2.6.31.5-vs2.3.0.36.21.4/kernel/vserver/context.c --- linux-2.6.31.5-vs2.3.0.36.21.3/kernel/vserver/context.c 2009-09-30 02:15:39.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/kernel/vserver/context.c 2009-11-05 04:18:09.000000000 +0100 @@ -397,7 +397,7 @@ struct vx_info *lookup_vx_info(int id) struct vx_info *vxi = NULL; if (id < 0) { - vxi = get_vx_info(current->vx_info); + vxi = get_vx_info(current_vx_info()); } else if (id > 1) { spin_lock(&vx_info_hash_lock); vxi = get_vx_info(__lookup_vx_info(id)); @@ -883,7 +883,7 @@ int vc_set_cflags(struct vx_info *vxi, v mask = vs_mask_mask(vc_data.mask, vxi->vx_flags, VXF_ONE_TIME); trigger = (mask & vxi->vx_flags) ^ (mask & vc_data.flagword); - if (vxi == current->vx_info) { + if (vxi == current_vx_info()) { /* if (trigger & VXF_STATE_SETUP) vx_mask_cap_bset(vxi, current); */ if (trigger & VXF_STATE_INIT) { diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/kernel/vserver/cvirt.c linux-2.6.31.5-vs2.3.0.36.21.4/kernel/vserver/cvirt.c --- linux-2.6.31.5-vs2.3.0.36.21.3/kernel/vserver/cvirt.c 2009-09-10 16:11:43.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/kernel/vserver/cvirt.c 2009-11-05 04:21:59.000000000 +0100 @@ -22,7 +22,7 @@ void vx_vsi_uptime(struct timespec *uptime, struct timespec *idle) { - struct vx_info *vxi = current->vx_info; + struct vx_info *vxi = current_vx_info(); set_normalized_timespec(uptime, uptime->tv_sec - vxi->cvirt.bias_uptime.tv_sec, @@ -114,7 +114,7 @@ int vx_do_syslog(int type, char __user * { int error = 0; int do_clear = 0; - struct vx_info *vxi = current->vx_info; + struct vx_info *vxi = current_vx_info(); struct _vx_syslog *log; if (!vxi) @@ -265,12 +265,15 @@ int vc_virt_stat(struct vx_info *vxi, vo void vx_gettimeofday(struct timeval *tv) { + struct vx_info *vxi; + do_gettimeofday(tv); if (!vx_flags(VXF_VIRT_TIME, 0)) return; - tv->tv_sec += current->vx_info->cvirt.bias_tv.tv_sec; - tv->tv_usec += current->vx_info->cvirt.bias_tv.tv_usec; + vxi = current_vx_info(); + tv->tv_sec += vxi->cvirt.bias_tv.tv_sec; + tv->tv_usec += vxi->cvirt.bias_tv.tv_usec; if (tv->tv_usec >= USEC_PER_SEC) { tv->tv_sec++; @@ -284,14 +287,15 @@ void vx_gettimeofday(struct timeval *tv) int vx_settimeofday(struct timespec *ts) { struct timeval tv; + struct vx_info *vxi; if (!vx_flags(VXF_VIRT_TIME, 0)) return do_settimeofday(ts); do_gettimeofday(&tv); - current->vx_info->cvirt.bias_tv.tv_sec = - ts->tv_sec - tv.tv_sec; - current->vx_info->cvirt.bias_tv.tv_usec = + vxi = current_vx_info(); + vxi->cvirt.bias_tv.tv_sec = ts->tv_sec - tv.tv_sec; + vxi->cvirt.bias_tv.tv_usec = (ts->tv_nsec/NSEC_PER_USEC) - tv.tv_usec; return 0; } diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/kernel/vserver/helper.c linux-2.6.31.5-vs2.3.0.36.21.4/kernel/vserver/helper.c --- linux-2.6.31.5-vs2.3.0.36.21.3/kernel/vserver/helper.c 2009-09-10 16:11:43.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/kernel/vserver/helper.c 2009-11-05 04:22:08.000000000 +0100 @@ -99,7 +99,7 @@ long vs_reboot_helper(struct vx_info *vx long vs_reboot(unsigned int cmd, void __user *arg) { - struct vx_info *vxi = current->vx_info; + struct vx_info *vxi = current_vx_info(); long ret = 0; vxdprintk(VXD_CBIT(misc, 5), diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/kernel/vserver/limit.c linux-2.6.31.5-vs2.3.0.36.21.4/kernel/vserver/limit.c --- linux-2.6.31.5-vs2.3.0.36.21.3/kernel/vserver/limit.c 2009-09-10 16:11:43.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/kernel/vserver/limit.c 2009-11-05 04:22:22.000000000 +0100 @@ -264,7 +264,7 @@ int vc_rlimit_stat(struct vx_info *vxi, void vx_vsi_meminfo(struct sysinfo *val) { - struct vx_info *vxi = current->vx_info; + struct vx_info *vxi = current_vx_info(); unsigned long totalram, freeram; rlim_t v; @@ -286,7 +286,7 @@ void vx_vsi_meminfo(struct sysinfo *val) void vx_vsi_swapinfo(struct sysinfo *val) { - struct vx_info *vxi = current->vx_info; + struct vx_info *vxi = current_vx_info(); unsigned long totalswap, freeswap; rlim_t v, w; diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/mm/slab_vs.h linux-2.6.31.5-vs2.3.0.36.21.4/mm/slab_vs.h --- linux-2.6.31.5-vs2.3.0.36.21.3/mm/slab_vs.h 2009-09-10 16:11:43.000000000 +0200 +++ linux-2.6.31.5-vs2.3.0.36.21.4/mm/slab_vs.h 2009-11-05 04:25:04.000000000 +0100 @@ -7,21 +7,23 @@ static inline void vx_slab_alloc(struct kmem_cache *cachep, gfp_t flags) { int what = gfp_zone(cachep->gfpflags); + struct vx_info *vxi = current_vx_info(); - if (!current->vx_info) + if (!vxi) return; - atomic_add(cachep->buffer_size, ¤t->vx_info->cacct.slab[what]); + atomic_add(cachep->buffer_size, &vxi->cacct.slab[what]); } static inline void vx_slab_free(struct kmem_cache *cachep) { int what = gfp_zone(cachep->gfpflags); + struct vx_info *vxi = current_vx_info(); - if (!current->vx_info) + if (!vxi) return; - atomic_sub(cachep->buffer_size, ¤t->vx_info->cacct.slab[what]); + atomic_sub(cachep->buffer_size, &vxi->cacct.slab[what]); } diff -NurpP linux-2.6.31.5-vs2.3.0.36.21.3/net/core/sock.c linux-2.6.31.5-vs2.3.0.36.21.4/net/core/sock.c --- linux-2.6.31.5-vs2.3.0.36.21.3/net/core/sock.c 2009-11-05 03:50:18.000000000 +0100 +++ linux-2.6.31.5-vs2.3.0.36.21.4/net/core/sock.c 2009-11-05 04:25:28.000000000 +0100 @@ -1891,7 +1891,7 @@ void sock_init_data(struct socket *sock, sk->sk_stamp = ktime_set(-1L, 0); - set_vx_info(&sk->sk_vx_info, current->vx_info); + set_vx_info(&sk->sk_vx_info, current_vx_info()); sk->sk_xid = vx_current_xid(); vx_sock_inc(sk); set_nx_info(&sk->sk_nx_info, current_nx_info());