Print this page
use NULL dump segop as a shorthand for no-op
Instead of forcing every segment driver to implement a dummy function that
does nothing, handle NULL dump segop function pointer as a no-op shorthand.
const-ify make segment ops structures
There is no reason to keep the segment ops structures writable.
use NULL setpagesize segop as a shorthand for ENOTSUP
Instead of forcing every segment driver to implement a dummp function to
return (hopefully) ENOTSUP, handle NULL setpagesize segop function pointer
as "return ENOTSUP" shorthand.
use NULL capable segop as a shorthand for no-capabilities
Instead of forcing every segment driver to implement a dummy "return 0"
function, handle NULL capable segop function pointer as "no copabilities
supported" shorthand.
segop_getpolicy already checks for a NULL op
seg_inherit_notsup is redundant since segop_inherit checks for NULL properly
patch lower-case-segops
use C99 initializers in segment ops structures
remove whole-process swapping
Long before Unix supported paging, it used process swapping to reclaim
memory. The code is there and in theory it runs when we get *extremely* low
on memory. In practice, it never runs since the definition of low-on-memory
is antiquated. (XXX: define what antiquated means)
You can check the number of swapout/swapin events with kstats:
$ kstat -p ::vm:swapin ::vm:swapout
@@ -176,48 +176,38 @@
static int segdev_getprot(struct seg *, caddr_t, size_t, uint_t *);
static u_offset_t segdev_getoffset(struct seg *, caddr_t);
static int segdev_gettype(struct seg *, caddr_t);
static int segdev_getvp(struct seg *, caddr_t, struct vnode **);
static int segdev_advise(struct seg *, caddr_t, size_t, uint_t);
-static void segdev_dump(struct seg *);
static int segdev_pagelock(struct seg *, caddr_t, size_t,
struct page ***, enum lock_type, enum seg_rw);
-static int segdev_setpagesize(struct seg *, caddr_t, size_t, uint_t);
static int segdev_getmemid(struct seg *, caddr_t, memid_t *);
-static lgrp_mem_policy_info_t *segdev_getpolicy(struct seg *, caddr_t);
-static int segdev_capable(struct seg *, segcapability_t);
/*
* XXX this struct is used by rootnex_map_fault to identify
* the segment it has been passed. So if you make it
* "static" you'll need to fix rootnex_map_fault.
*/
-struct seg_ops segdev_ops = {
- segdev_dup,
- segdev_unmap,
- segdev_free,
- segdev_fault,
- segdev_faulta,
- segdev_setprot,
- segdev_checkprot,
- (int (*)())segdev_badop, /* kluster */
- (size_t (*)(struct seg *))NULL, /* swapout */
- segdev_sync, /* sync */
- segdev_incore,
- segdev_lockop, /* lockop */
- segdev_getprot,
- segdev_getoffset,
- segdev_gettype,
- segdev_getvp,
- segdev_advise,
- segdev_dump,
- segdev_pagelock,
- segdev_setpagesize,
- segdev_getmemid,
- segdev_getpolicy,
- segdev_capable,
- seg_inherit_notsup
+const struct seg_ops segdev_ops = {
+ .dup = segdev_dup,
+ .unmap = segdev_unmap,
+ .free = segdev_free,
+ .fault = segdev_fault,
+ .faulta = segdev_faulta,
+ .setprot = segdev_setprot,
+ .checkprot = segdev_checkprot,
+ .kluster = (int (*)())segdev_badop,
+ .sync = segdev_sync,
+ .incore = segdev_incore,
+ .lockop = segdev_lockop,
+ .getprot = segdev_getprot,
+ .getoffset = segdev_getoffset,
+ .gettype = segdev_gettype,
+ .getvp = segdev_getvp,
+ .advise = segdev_advise,
+ .pagelock = segdev_pagelock,
+ .getmemid = segdev_getmemid,
};
/*
* Private segdev support routines
*/
@@ -430,11 +420,11 @@
} else {
/*
* Mappings of /dev/null don't count towards the VSZ of a
* process. Mappings of /dev/null have no mapping type.
*/
- if ((SEGOP_GETTYPE(seg, (seg)->s_base) & (MAP_SHARED |
+ if ((segop_gettype(seg, seg->s_base) & (MAP_SHARED |
MAP_PRIVATE)) == 0) {
seg->s_as->a_resvsize -= seg->s_size;
}
}
@@ -2379,18 +2369,10 @@
return (0);
}
/*
- * segdev pages are not dumped, so we just return
- */
-/*ARGSUSED*/
-static void
-segdev_dump(struct seg *seg)
-{}
-
-/*
* ddi_segmap_setup: Used by drivers who wish specify mapping attributes
* for a segment. Called from a drivers segmap(9E)
* routine.
*/
/*ARGSUSED*/
@@ -2478,18 +2460,10 @@
TRACE_0(TR_FAC_DEVMAP, TR_DEVMAP_PAGELOCK,
"segdev_pagelock:start");
return (ENOTSUP);
}
-/*ARGSUSED*/
-static int
-segdev_setpagesize(struct seg *seg, caddr_t addr, size_t len,
- uint_t szc)
-{
- return (ENOTSUP);
-}
-
/*
* devmap_device: Used by devmap framework to establish mapping
* called by devmap_seup(9F) during map setup time.
*/
/*ARGSUSED*/
@@ -4030,24 +4004,10 @@
memidp->val[0] = (uintptr_t)VTOCVP(sdp->vp);
memidp->val[1] = sdp->offset + (uintptr_t)(addr - seg->s_base);
return (0);
}
-/*ARGSUSED*/
-static lgrp_mem_policy_info_t *
-segdev_getpolicy(struct seg *seg, caddr_t addr)
-{
- return (NULL);
-}
-
-/*ARGSUSED*/
-static int
-segdev_capable(struct seg *seg, segcapability_t capability)
-{
- return (0);
-}
-
/*
* ddi_umem_alloc() non-pageable quantum cache max size.
* This is just a SWAG.
*/
#define DEVMAP_UMEM_QUANTUM (8*PAGESIZE)