diff options
author | sl108498 <none@none> | 2006-09-19 15:49:28 -0700 |
---|---|---|
committer | sl108498 <none@none> | 2006-09-19 15:49:28 -0700 |
commit | c6939658adb0a356a77bc28f7df252ceb4a8f6cc (patch) | |
tree | 2e24cb01bd59e15cda6ad68fa5d778b4cf571fa7 /usr/src/uts/common/sys | |
parent | 69889278ff50c08a6682a39ce6b5d97c5f0c2387 (diff) | |
download | illumos-joyent-c6939658adb0a356a77bc28f7df252ceb4a8f6cc.tar.gz |
PSARC/2004/580 zone/project.max-locked-memory Resource Controls
PSARC/2006/463 Amendment_to_zone_project.max-locked-memory_Resource_Controls
5053609 RFE: need zone.max-locked-memory rctl
4691104 Need mlock capability without requiring superuser privileges
Diffstat (limited to 'usr/src/uts/common/sys')
-rw-r--r-- | usr/src/uts/common/sys/ddi_implfuncs.h | 6 | ||||
-rw-r--r-- | usr/src/uts/common/sys/ddidevmap.h | 9 | ||||
-rw-r--r-- | usr/src/uts/common/sys/proc.h | 6 | ||||
-rw-r--r-- | usr/src/uts/common/sys/project.h | 6 | ||||
-rw-r--r-- | usr/src/uts/common/sys/rctl.h | 6 | ||||
-rw-r--r-- | usr/src/uts/common/sys/shm_impl.h | 11 | ||||
-rw-r--r-- | usr/src/uts/common/sys/zone.h | 10 |
7 files changed, 37 insertions, 17 deletions
diff --git a/usr/src/uts/common/sys/ddi_implfuncs.h b/usr/src/uts/common/sys/ddi_implfuncs.h index e4ef2f0e3e..ad70123d76 100644 --- a/usr/src/uts/common/sys/ddi_implfuncs.h +++ b/usr/src/uts/common/sys/ddi_implfuncs.h @@ -273,10 +273,8 @@ void e_devid_cache_free_devt_list(int, dev_t *); /* * Resource control functions to lock down device memory. */ -extern int i_ddi_incr_locked_memory(proc_t *, task_t *, kproject_t *, - zone_t *, rctl_qty_t); -extern void i_ddi_decr_locked_memory(proc_t *, task_t *, kproject_t *, - zone_t *, rctl_qty_t); +extern int i_ddi_incr_locked_memory(proc_t *, rctl_qty_t); +extern void i_ddi_decr_locked_memory(proc_t *, rctl_qty_t); #endif /* _KERNEL */ diff --git a/usr/src/uts/common/sys/ddidevmap.h b/usr/src/uts/common/sys/ddidevmap.h index 7798f1d7cd..734c04417d 100644 --- a/usr/src/uts/common/sys/ddidevmap.h +++ b/usr/src/uts/common/sys/ddidevmap.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -93,7 +92,7 @@ struct ddi_umem_cookie { */ ulong_t cook_refcnt; /* cookie reference count */ struct ddi_umem_cookie *unl_forw; /* list ptr for unlock cookies */ - void *lockmem_proj; /* project ptr for resource mgmt */ + void *reserved; /* unused */ }; typedef struct as *ddi_as_handle_t; diff --git a/usr/src/uts/common/sys/proc.h b/usr/src/uts/common/sys/proc.h index 13a3605e66..4c4025e649 100644 --- a/usr/src/uts/common/sys/proc.h +++ b/usr/src/uts/common/sys/proc.h @@ -342,6 +342,8 @@ typedef struct proc { /* additional lock to protect p_sessp (but not its contents) */ kmutex_t p_splock; + rctl_qty_t p_locked_mem; /* locked memory charged to proc */ + /* protected by p_lock */ } proc_t; #define PROC_T /* headers relying on proc_t are OK */ @@ -486,8 +488,8 @@ extern struct pid pid0; /* p0's pid */ * These flags are used to synchronize with the pool subsystem to allow * re-binding of processes to new pools. */ -#define PBWAIT 0x0001 /* process should wait outside fork/exec/exit */ -#define PEXITED 0x0002 /* process exited and about to become zombie */ +#define PBWAIT 0x0001 /* process should wait outside fork/exec/exit */ +#define PEXITED 0x0002 /* process exited and about to become zombie */ /* Macro to convert proc pointer to a user block pointer */ #define PTOU(p) (&(p)->p_user) diff --git a/usr/src/uts/common/sys/project.h b/usr/src/uts/common/sys/project.h index 181c18b651..679c1eddc2 100644 --- a/usr/src/uts/common/sys/project.h +++ b/usr/src/uts/common/sys/project.h @@ -40,9 +40,11 @@ extern "C" { typedef struct kproject_data { /* Datum protected by: */ rctl_qty_t kpd_shmmax; /* shm's ipcs_lock */ ipc_rqty_t kpd_ipc; /* shm|sem|msg's ipcs lock */ - rctl_qty_t kpd_devlockmem; /* umem_devlockmem_rctl_lock */ + rctl_qty_t kpd_locked_mem; /* zone_rctl_lock */ + rctl_qty_t kpd_locked_mem_ctl; /* kpj_rctls->rcs_lock */ rctl_qty_t kpd_contract; /* contract_lock */ rctl_qty_t kpd_crypto_mem; /* crypto_rctl_lock */ + } kproject_data_t; /* @@ -84,7 +86,7 @@ projid_t curprojid(void); extern kproject_t *proj0p; extern rctl_hndl_t rc_project_nlwps; extern rctl_hndl_t rc_project_ntasks; - +extern rctl_hndl_t rc_project_locked_mem; #endif /* _KERNEL */ #ifdef __cplusplus diff --git a/usr/src/uts/common/sys/rctl.h b/usr/src/uts/common/sys/rctl.h index 02bcef6f36..eb56fff9e5 100644 --- a/usr/src/uts/common/sys/rctl.h +++ b/usr/src/uts/common/sys/rctl.h @@ -319,6 +319,12 @@ int rctl_rlimit_set(rctl_hndl_t, struct proc *, struct rlimit64 *, rctl_alloc_gp_t *, int, int, const struct cred *); int rctl_rlimit_get(rctl_hndl_t, struct proc *, struct rlimit64 *); +/* specific rctl utility functions */ +int rctl_incr_locked_mem(struct proc *, struct kproject *, rctl_qty_t, + int); +void rctl_decr_locked_mem(struct proc *, struct kproject *, rctl_qty_t, + int); + #endif /* _KERNEL */ #ifdef __cplusplus diff --git a/usr/src/uts/common/sys/shm_impl.h b/usr/src/uts/common/sys/shm_impl.h index f43fad4c87..4d8cdcede5 100644 --- a/usr/src/uts/common/sys/shm_impl.h +++ b/usr/src/uts/common/sys/shm_impl.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -59,6 +58,10 @@ typedef struct kshmid { size_t shm_segsz; /* size of segment in bytes */ struct anon_map *shm_amp; /* segment anon_map pointer */ ushort_t shm_lkcnt; /* number of times it is being locked */ + pgcnt_t shm_lkpages; /* number of pages locked by shmctl */ + kmutex_t shm_mlock; /* held when locking physical pages */ + /* Therefore, protects p_lckcnt for */ + /* pages that back shm */ pid_t shm_lpid; /* pid of last shmop */ pid_t shm_cpid; /* pid of creator */ ulong_t shm_ismattch; /* number of ISM attaches */ diff --git a/usr/src/uts/common/sys/zone.h b/usr/src/uts/common/sys/zone.h index 636b8acc0f..daccd16bdf 100644 --- a/usr/src/uts/common/sys/zone.h +++ b/usr/src/uts/common/sys/zone.h @@ -326,6 +326,14 @@ typedef struct zone { uint_t zone_rootpathlen; /* strlen(zone_rootpath) + 1 */ uint32_t zone_shares; /* FSS shares allocated to zone */ rctl_set_t *zone_rctls; /* zone-wide (zone.*) rctls */ + kmutex_t zone_rctl_lock; /* protects zone_locked_mem and */ + /* kpd_locked_mem for all */ + /* projects in zone */ + /* grab after p_lock, before rcs_lock */ + rctl_qty_t zone_locked_mem; /* bytes of locked memory in zone */ + rctl_qty_t zone_locked_mem_ctl; /* current locked memory */ + /* limit. Protected by */ + /* zone_rctls->rcs_lock */ list_t zone_zsd; /* list of Zone-Specific Data values */ kcondvar_t zone_cv; /* used to signal state changes */ struct proc *zone_zsched; /* Dummy kernel "zsched" process */ @@ -544,6 +552,8 @@ extern void mount_completed(void); extern int zone_walk(int (*)(zone_t *, void *), void *); +extern rctl_hndl_t rc_zone_locked_mem; + #endif /* _KERNEL */ #ifdef __cplusplus |