/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* 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
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
/*
* VM - generic vnode mapping segment.
*
* The segmap driver is used only by the kernel to get faster (than seg_vn)
* mappings [lower routine overhead; more persistent cache] to random
*/
#include <sys/sysmacros.h>
#include <vm/seg_kmem.h>
/*
* Private seg op routines.
*/
static void segmap_badop(void);
/* segkpm support */
SEGMAP_BADOP(int), /* dup */
SEGMAP_BADOP(int), /* unmap */
SEGMAP_BADOP(int), /* setprot */
SEGMAP_BADOP(int), /* sync */
SEGMAP_BADOP(int), /* lockop */
SEGMAP_BADOP(int), /* advise */
segmap_pagelock, /* pagelock */
SEGMAP_BADOP(int), /* setpgsz */
segmap_getmemid, /* getmemid */
segmap_getpolicy, /* getpolicy */
segmap_capable, /* capable */
seg_inherit_notsup /* inherit */
};
/*
* Private segmap routines.
*/
/*
* Statistics for segmap operations.
*
* No explicit locking to protect these stats.
*/
{ "fault", KSTAT_DATA_ULONG },
{ "faulta", KSTAT_DATA_ULONG },
{ "getmap", KSTAT_DATA_ULONG },
{ "get_use", KSTAT_DATA_ULONG },
{ "get_reclaim", KSTAT_DATA_ULONG },
{ "get_reuse", KSTAT_DATA_ULONG },
{ "get_unused", KSTAT_DATA_ULONG },
{ "get_nofree", KSTAT_DATA_ULONG },
{ "rel_async", KSTAT_DATA_ULONG },
{ "rel_write", KSTAT_DATA_ULONG },
{ "rel_free", KSTAT_DATA_ULONG },
{ "rel_abort", KSTAT_DATA_ULONG },
{ "rel_dontneed", KSTAT_DATA_ULONG },
{ "release", KSTAT_DATA_ULONG },
{ "pagecreate", KSTAT_DATA_ULONG },
{ "free_notfree", KSTAT_DATA_ULONG },
{ "free_dirty", KSTAT_DATA_ULONG },
{ "free", KSTAT_DATA_ULONG },
{ "stolen", KSTAT_DATA_ULONG },
{ "get_nomtx", KSTAT_DATA_ULONG }
};
/*
* Return number of map pages in segment.
*/
/*
* Translate addr into smap number within segment.
*/
/*
* Translate addr in seg into struct smap pointer.
*/
/*
* Bit in map (16 bit bitmap).
*/
static int smd_colormsk = 0;
static int smd_ncolor = 0;
static int smd_nfree = 0;
static int smd_freemsk = 0;
#ifdef DEBUG
static int *colors_used;
#endif
#ifdef SEGMAP_HASHSTATS
static unsigned int *smd_hash_len;
#endif
union segmap_cpu {
struct {
} scpu;
};
/*
* There are three locks in seg_map:
* - per freelist mutexes
* - per hashchain mutexes
* - per smap mutexes
*
* The lock ordering is to get the smap mutex to lock down the slot
* freelist lock to put the slot back on the free list.
*
* The hash search is done by only holding the hashchain lock, when a wanted
* slot is found, we drop the hashchain lock then lock the slot so there
* is no overlapping of hashchain and smap locks. After the slot is
* locked, we verify again if the slot is still what we are looking
* for.
*
* Allocation of a free slot is done by holding the freelist lock,
* then locking the smap slot at the head of the freelist. This is
* in reversed lock order so mutex_tryenter() is used.
*
* The smap lock protects all fields in smap structure except for
* hashchain and freelist locks.
*/
{ \
}
/*
* The most frequently updated kstat counters are kept in the
* per cpu array to avoid hot cache blocks. The update function
* sums the cpu local counters to update the global counters.
*/
/* ARGSUSED */
int
{
int i;
if (rw == KSTAT_WRITE)
return (EACCES);
for (i = 0; i < max_ncpus; i++) {
}
return (0);
}
int
{
long i, npages;
extern void prefetch_smap_w(void *);
extern int max_ncpus;
panic("segkmap not MAXBSIZE aligned");
/*NOTREACHED*/
}
/*
* Scale the number of smap freelists to be
* proportional to max_ncpus * number of virtual colors.
* The caller can over-ride this scaling by providing
* a non-zero a->nfreelist argument.
*/
if (nfreelist == 0)
}
/* round up nfreelist to the next power of two. */
}
/*
* Get the number of virtual colors - must be a power of 2.
*/
if (a->shmsize)
else
smd_ncolor = 1;
/*
* Allocate and initialize the freelist headers.
* Note that sm_freeq[1] starts out as the release queue. This
* is known when the smap structures are initialized below.
*/
for (i = 0; i < smd_nfree; i++) {
}
/*
* Allocate and initialize the smap hash chain headers.
* Compute hash size rounding down to the next power of two.
*/
#ifdef SEGMAP_HASHSTATS
#endif
}
/*
* Allocate and initialize the smap structures.
* Link all slots onto the appropriate freelist.
* The smap array is large enough to affect boot time
* on large systems, so use memory prefetching and only
* go through the array 1 time. Inline a optimized version
* of segmap_smapadd to add structures to freelists with
* knowledge that no locks are needed here.
*/
prefetch_smap_w((char *)smp);
if (smpfreelist == 0) {
} else {
}
/*
* sm_flag = 0 (no SM_QNDX_ZERO) implies smap on sm_freeq[1]
*/
#ifdef SEGKPM_SUPPORT
/*
* Due to the fragile prefetch loop no
* separate function is used here.
*/
#endif
}
/*
* Allocate the per color indices that distribute allocation
* requests over the free lists. Each cpu will have a private
* rotor index to spread the allocations even across the available
* smap freelists. Init the scpu_last_smap field to the first
* smap element so there is no need to check for NULL.
*/
smd_cpu =
int j;
for (j = 0; j < smd_ncolor; j++)
}
vpm_init();
#ifdef DEBUG
/*
* Keep track of which colors are used more often.
*/
#endif /* DEBUG */
return (0);
}
static void
{
}
/*
* Do a F_SOFTUNLOCK call over the range requested.
* The range must have already been F_SOFTLOCK'ed.
*/
static void
{
#ifdef lint
#endif
/*
* We're called only from segmap_fault and this was a
* NOP in case of a kpm based smap, so dangerous things
* must have happened in the meantime. Pages are prefaulted
* and locked in segmap_getmapflt and they will not be
* unlocked until segmap_release.
*/
/*NOTREACHED*/
}
/*
* Use page_find() instead of page_lookup() to
* find the page since we know that it has
* "shared" lock.
*/
panic("segmap_unlock: page not found");
/*NOTREACHED*/
}
hat_setref(pp);
}
/*
* Clear bitmap, if the bit corresponding to "off" is set,
* since the page and translation are being unlocked.
*/
/*
* Large Files: Following assertion is to verify
* the correctness of the cast to (int) above.
*/
}
}
}
/*
* This routine is called via a machine specific fault handling
* routine. It is also called by software routines wishing to
* lock or unlock a range of addresses.
*
* Note that this routine expects a page-aligned "addr".
*/
enum fault_type type,
{
int err;
int hat_flag;
int newpage;
/*
* Pages are successfully prefaulted and locked in
* segmap_getmapflt and can't be unlocked until
* segmap_release. No hat mappings have to be locked
* and they also can't be unlocked as long as the
* caller owns an active kpm addr.
*/
#ifndef DEBUG
if (type != F_SOFTUNLOCK)
return (0);
#endif
panic("segmap_fault: smap not found "
"for addr %p", (void *)addr);
/*NOTREACHED*/
}
#ifdef DEBUG
if (newpage) {
(void *)smp);
}
if (type != F_SOFTUNLOCK) {
return (0);
}
#endif
return (FC_MAKE_ERR(EIO));
panic("segmap_fault: endaddr %p exceeds MAXBSIZE chunk",
panic("segmap_fault: softunlock page not found");
/*
* Set ref bit also here in case of S_OTHER to avoid the
* overhead of supporting other cases than F_SOFTUNLOCK
* with segkpm. We can do this because the underlying
* pages are locked anyway.
*/
} else {
"segmap_fault:pp %p vp %p offset %llx",
hat_setref(pp);
}
return (0);
}
return (FC_MAKE_ERR(EIO));
panic("segmap_fault: endaddr %p "
/*NOTREACHED*/
}
/*
* First handle the easy stuff
*/
if (type == F_SOFTUNLOCK) {
return (0);
}
if (err)
return (FC_MAKE_ERR(err));
/*
* Handle all pages returned in the pl[] array.
* This loop is coded on the assumption that if
* there was no error from the VOP_GETPAGE routine,
* that the page list returned will contain all the
* needed pages for the vp from [off..off + len].
*/
/*
* Verify that the pages returned are within the range
* of this segmap region. Note that it is theoretically
* possible for pages outside this range to be returned,
* but it is not very likely. If we cannot use the
* page here, just release it and go on to the next one.
*/
continue;
}
hat_setref(pp);
"segmap_fault:pp %p vp %p offset %llx",
if (type == F_SOFTLOCK)
}
/*
* Deal with VMODSORT pages here. If we know this is a write
* do the setmod now and allow write protection.
* As long as it's modified or not S_OTHER, remove write
* protection. With S_OTHER it's up to the FS to deal with this.
*/
if (IS_VMODSORT(vp)) {
hat_setmod(pp);
prot &= ~PROT_WRITE;
}
if (hat_flag != HAT_LOAD_LOCK)
}
return (0);
}
/*
* This routine is used to start I/O on pages asynchronously.
*/
static faultcode_t
{
int err;
int newpage;
/*
* Pages are successfully prefaulted and locked in
* segmap_getmapflt and can't be unlocked until
* segmap_release. No hat mappings have to be locked
* and they also can't be unlocked as long as the
* caller owns an active kpm addr.
*/
#ifdef DEBUG
panic("segmap_faulta: smap not found "
"for addr %p", (void *)addr);
/*NOTREACHED*/
}
if (newpage)
(void *)smp);
#endif
return (0);
}
return (FC_MAKE_ERR(EIO));
}
if (err)
return (FC_MAKE_ERR(err));
return (0);
}
/*ARGSUSED*/
static int
{
/*
* Need not acquire the segment lock since
* "smd_prot" is a read-only field.
*/
}
static int
{
if (pgno != 0) {
do {
} while (pgno != 0);
}
return (0);
}
static u_offset_t
{
}
/*ARGSUSED*/
static int
{
return (MAP_SHARED);
}
/*ARGSUSED*/
static int
{
/* XXX - This doesn't make any sense */
return (0);
}
/*
* addr + delta relative to the mapping at addr. We assume here
* that delta is a signed PAGESIZE'd multiple (which can be negative).
*
* For segmap we always "approve" of this action from our standpoint.
*/
/*ARGSUSED*/
static int
{
return (0);
}
static void
{
panic("segmap_badop");
/*NOTREACHED*/
}
/*
* Special private segmap operations
*/
/*
* Add smap to the appropriate free list.
*/
static void
{
panic("segmap_smapadd");
/*NOTREACHED*/
}
/*
* Add to the tail of the release queue
* Note that sm_releq and sm_allocq could toggle
* before we get the lock. This does not affect
* correctness as the 2 queues are only maintained
* to reduce lock pressure.
*/
else
if (smpfreelist == 0) {
int want;
/*
* Both queue mutexes held to set sm_want;
* snapshot the value before dropping releq mutex.
* If sm_want appears after the releq mutex is dropped,
* then the smap just freed is already gone.
*/
/*
* See if there was a waiter before dropping the releq mutex
* then recheck after obtaining sm_freeq[0] mutex as
* the another thread may have already signaled.
*/
if (want) {
}
} else {
}
}
static struct smap *
{
/*
* First we need to verify that no one has created a smp
* with (vp,off) as its tag before we us.
*/
break;
/*
* No one created one yet.
*
* Funniness here - we don't increment the ref count on the
* vnode * even though we have another pointer to it here.
* The reason for this is that we don't want the fact that
* a seg_map entry somewhere refers to a vnode to prevent the
* vnode * itself from going away. This is because this
* reference to the vnode is a "soft one". In the case where
* a mapping is being used by a rdwr [or directory routine?]
* there already has to be a non-zero ref count on the vnode.
* In the case where the vp has been freed and the the smap
* structure is on the free list, there are no pages in memory
* that can refer to the vnode. Thus even if we reuse the same
* address but represents a different object, we are ok.
*/
#ifdef SEGMAP_HASHSTATS
smd_hash_len[hashid]++;
#endif
}
return (tmp);
}
static void
{
int hashid;
for (;;) {
panic("segmap_hashout");
/*NOTREACHED*/
}
break;
}
#ifdef SEGMAP_HASHSTATS
smd_hash_len[hashid]--;
#endif
}
/*
* Attempt to free unmodified, unmapped, and non locked segmap
* pages.
*/
void
{
continue;
case PGREL_NOTREL:
break;
case PGREL_MOD:
break;
case PGREL_CLEAN:
break;
}
}
}
/*
* Locks held on entry: smap lock
* Locks held on exit : smap lock.
*/
static void
{
/*
* Destroy old vnode association and
* unload any hardware translations to
* the old object.
*/
/*
* This node is off freelist and hashlist,
* across calls to hat_unload.
*/
if (segmap_kpm) {
int hat_unload_needed = 0;
/*
* unload kpm mapping
*/
}
/*
* Check if we have (also) the rare case of a
* non kpm mapping.
*/
hat_unload_needed = 1;
}
if (hat_unload_needed) {
}
} else {
}
}
}
static struct smap *
{
/*
* The alloc list is empty or this queue is being skipped;
* first see if the allocq toggled.
*/
/* queue changed */
goto retry_queue;
}
/* cannot get releq; a free smp may be there now */
/*
* This loop could spin forever if this thread has
* higher priority than the thread that is holding
* releq->smq_mtx. In order to force the other thread
* since we just unlocked the allocq mutex.
*/
goto retry_queue;
}
/*
* This freelist is empty.
* This should not happen unless clients
* are failing to release the segmap
* window after accessing the data.
* Before resorting to sleeping, try
* the next list of the same color.
*/
goto retry_queue;
}
/*
* Tried all freelists of the same color once,
* wait on this list and hope something gets freed.
*/
goto retry_queue;
} else {
/*
* Something on the rele queue; flip the alloc
* and rele queues and retry.
*/
if (page_locked) {
page_locked = 0;
}
goto retry_queue;
}
} else {
/*
* Fastpath the case we get the smap mutex
* on the first try.
*/
if (!mutex_tryenter(smtx)) {
/*
* Another thread is trying to reclaim this slot.
* Skip to the next queue or smap.
*/
goto skip_queue;
} else {
goto next_smap;
}
} else {
/*
* if kpme exists, get shared lock on the page
*/
page_locked = 1;
goto skip_queue;
} else {
goto next_smap;
}
} else {
}
}
}
}
/*
* At this point, we've selected smp. Remove smp
* from its freelist. If smp is the first one in
* the freelist, update the head of the freelist.
*/
}
/*
* if the head of the freelist still points to smp,
* then there are no more free smaps in that list.
*/
/*
* Took the last one
*/
else {
}
/*
* if pp != NULL, pp must have been locked;
* grab_smp() unlocks pp.
*/
/* return smp locked. */
return (smp);
}
}
}
/*
* Special public segmap operations
*/
/*
* Create pages (without using VOP_GETPAGE) and load up translations to them.
* If softlock is TRUE, then set things up so that it looks like a call
* to segmap_fault with F_SOFTLOCK.
*
* Returns 1, if a page is created by calling page_create_va(), or 0 otherwise.
*
* All fields in the generic segment (struct seg) are considered to be
* read-only for "segmap" even though the kernel address space (kas) may
* not be locked, hence no lock is needed to access them.
*/
int
{
int newpage = 0;
int hat_flag;
/*
* Pages are successfully prefaulted and locked in
* segmap_getmapflt and can't be unlocked until
* segmap_release. The SM_KPM_NEWPAGE flag is set
* in segmap_pagecreate_kpm when new pages are created.
* and it is returned as "newpage" indication here.
*/
panic("segmap_pagecreate: smap not found "
"for addr %p", (void *)addr);
/*NOTREACHED*/
}
return (newpage);
}
/*
* We don't grab smp mutex here since we assume the smp
* has a refcnt set already which prevents the slot from
* changing its id.
*/
panic("segmap_pagecreate: page_create failed");
/*NOTREACHED*/
}
newpage = 1;
/*
* Since pages created here do not contain valid
* data until the caller writes into them, the
* "exclusive" lock will not be dropped to prevent
* other users from accessing the page. We also
* have to lock the translation to prevent a fault
* from occurring when the virtual address mapped by
* this page is written into. This is necessary to
* avoid a deadlock since we haven't dropped the
* "exclusive" lock.
*/
/*
* Large Files: The following assertion is to
* verify the cast above.
*/
} else if (softlock) {
}
hat_setmod(pp);
if (hat_flag != HAT_LOAD_LOCK)
"segmap_pagecreate:seg %p addr %p pp %p vp %p offset %llx",
}
return (newpage);
}
void
{
/*
* Pages are successfully prefaulted and locked in
* segmap_getmapflt and can't be unlocked until
* segmap_release, so no pages or hat mappings have
* to be unlocked at this point.
*/
#ifdef DEBUG
panic("segmap_pageunlock: smap not found "
"for addr %p", (void *)addr);
/*NOTREACHED*/
}
#endif
return;
}
/*
* Large Files: Following assertion is to verify
* the correctness of the cast to (int) above.
*/
/*
* If the bit corresponding to "off" is set,
* clear this bit in the bitmap, unlock translations,
* and release the "exclusive" lock on the page.
*/
/*
* Use page_find() instead of page_lookup() to
* find the page since we know that it has
* "exclusive" lock.
*/
panic("segmap_pageunlock: page not found");
/*NOTREACHED*/
}
hat_setref(pp);
}
}
}
}
{
}
/*
* This is the magic virtual address that offset 0 of an ELF
* file gets mapped to in user space. This is used to pick
* the vac color on the freelist.
*/
/*
* segmap_getmap allocates a MAXBSIZE big slot to map the vnode vp
* in the range <off, off + len). off doesn't need to be MAXBSIZE aligned.
* The return address is always MAXBSIZE aligned.
*
* If forcefault is nonzero and the MMU translations haven't yet been created,
* segmap_getmap will call segmap_fault(..., F_INVAL, rw) to create them.
*/
int forcefault,
{
extern struct vnode *common_specvp();
int newslot;
int error;
panic("segmap_getmap bad len");
/*NOTREACHED*/
}
/*
* If this is a block device we have to be sure to use the
* "common" block device vnode for the mapping.
*/
if (segmap_kpm == 0 ||
is_kpm = 0;
}
break;
/*
* Get smap lock and recheck its tag. The hash lock
* is dropped since the hash is based on (vp, off)
* and (vp, off) won't change when we have smap mtx.
*/
goto retry_hash;
}
/*
* Could still be on the free list. However, this
* could also be an smp that is transitioning from
* the free list when we have too much contention
* for the smapmtx's. In this case, we have an
* unlocked smp that is not on the free list any
* longer, but still has a 0 refcnt. The only way
* to be sure is to check the freelist pointers.
* Since we now have the smapmtx, we are guaranteed
* that the (vp, off) won't change, so we are safe
* to reclaim it. get_free_smp() knows that this
* can happen, and it will check the refcnt.
*/
else
/*
* fastpath normal case
*/
/*
* Taking the last smap on freelist
*/
} else {
/*
* Reclaiming 1st smap on list
*/
}
} else {
}
} else {
}
/*
* We don't invoke segmap_fault via TLB miss, so we set ref
* and mod bits in advance. For S_OTHER we set them in
* segmap_fault F_SOFTUNLOCK.
*/
if (is_kpm) {
}
}
newslot = 0;
} else {
/*
* On a PAC machine or a machine with anti-alias
* hardware, smd_colormsk will be zero.
*
* On a VAC machine- pick color by offset in the file
* so we won't get VAC conflicts on elf files.
* On data files, color does not matter but we
* don't know what kind of file it is so we always
* pick color by offset. This causes color
* corresponding to file offset zero to be used more
* heavily.
*/
#ifdef DEBUG
colors_used[free_ndx]++;
#endif /* DEBUG */
/*
* Get a locked smp slot from the free list.
*/
/*
* Failed to hashin, there exists one now.
* Return the smp we just allocated.
*/
goto vrfy_smp;
}
/*
* We don't invoke segmap_fault via TLB miss, so we set ref
* and mod bits in advance. For S_OTHER we set them in
* segmap_fault F_SOFTUNLOCK.
*/
if (is_kpm) {
}
}
newslot = 1;
}
if (!is_kpm)
goto use_segmap_range;
/*
* Use segkpm
*/
/* Lint directive required until 6746211 is fixed */
/*CONSTCOND*/
/*
* remember the last smp faulted on this cpu.
*/
if (forcefault == SM_PAGECREATE) {
return (baseaddr);
}
if (newslot == 0 &&
/* fastpath */
switch (rw) {
case S_READ:
case S_WRITE:
}
} else {
}
break;
}
break;
}
/*
* We have the p_selock as reader, grab_smp
* can't hit us, we have bumped the smap
* refcnt and hat_pageunload needs the
* p_selock exclusive.
*/
} else {
panic("segmap_getmapflt: stale "
"kpme page, kpme %p", (void *)kpme);
/*NOTREACHED*/
}
/*
* We don't invoke segmap_fault via TLB miss,
* so we set ref and mod bits in advance.
* For S_OTHER and we set them in segmap_fault
* F_SOFTUNLOCK.
*/
hat_setref(pp);
return (baseaddr);
default:
break;
}
}
/*
* Use segmap address slot and let segmap_fault deal
* with the error cases. There is no error return
* possible here.
*/
goto use_segmap_range;
}
/*
* When prot is not returned w/ PROT_ALL the returned pages
* are not backed by fs blocks. For most of the segmap users
* this is no problem, they don't write to the pages in the
* same request and therefore don't rely on a following
* trap driven segmap_fault. With SM_LOCKPROTO users it
* is more secure to use segkmap adresses to allow
* protection segmap_fault's.
*/
/*
* Use segmap address slot and let segmap_fault
* do the error return.
*/
forcefault = 0;
goto use_segmap_range;
}
/*
* We have the p_selock as reader, grab_smp can't hit us, we
* have bumped the smap refcnt and hat_pageunload needs the
* p_selock exclusive.
*/
} else {
panic("segmap_getmapflt: stale kpme page after "
"VOP_GETPAGE, kpme %p", (void *)kpme);
/*NOTREACHED*/
}
return (baseaddr);
"segmap_getmap:seg %p addr %p vp %p offset %llx",
/*
* Prefault the translations
*/
}
return (baseaddr);
}
int
{
int error;
int bflags = 0;
int is_kpm = 0;
panic("segmap_release: addr %p not "
"MAXBSIZE aligned", (void *)addr);
/*NOTREACHED*/
}
panic("segmap_release: smap not found "
"for addr %p", (void *)addr);
/*NOTREACHED*/
}
"segmap_relmap:seg %p addr %p smp %p",
/*
* For compatibility reasons segmap_pagecreate_kpm sets this
* flag to allow a following segmap_pagecreate to return
* this as "newpage" flag. When segmap_pagecreate is not
* called at all we clear it now.
*/
is_kpm = 1;
hat_setref(pp);
}
} else {
/*NOTREACHED*/
}
"segmap_relmap:seg %p addr %p smp %p",
}
/*
* Need to call VOP_PUTPAGE() if any flags (except SM_DONTNEED)
* are set.
*/
if ((flags & ~SM_DONTNEED) != 0) {
}
}
if (flags & SM_DESTROY) {
}
/*
* We only bother doing the FREE and DONTNEED flags
* if no one else is still referencing this mapping.
*/
}
if (flags & SM_DONTNEED) {
bflags |= B_DONTNEED;
}
}
} else {
}
if (is_kpm) {
}
} else {
if (segmap_kpm)
}
}
}
if (is_kpm)
/*
* Now invoke VOP_PUTPAGE() if any flags (except SM_DONTNEED)
* are set.
*/
if ((flags & ~SM_DONTNEED) != 0) {
} else {
error = 0;
}
return (error);
}
/*
* Dump the pages belonging to this segmap segment.
*/
static void
{
int we_own_it = 0;
/*
* If pp == NULL, the page either does
* not exist or is exclusively locked.
* So determine if it exists before
* searching for it.
*/
we_own_it = 1;
else
if (pp) {
if (we_own_it)
}
}
}
}
}
/*ARGSUSED*/
static int
{
return (ENOTSUP);
}
static int
{
return (0);
}
/*ARGSUSED*/
static lgrp_mem_policy_info_t *
{
return (NULL);
}
/*ARGSUSED*/
static int
{
return (0);
}
#ifdef SEGKPM_SUPPORT
/*
* segkpm support routines
*/
static caddr_t
{
int newpage = 0;
panic("segmap_pagecreate_kpm: "
"page_create failed");
/*NOTREACHED*/
}
newpage = 1;
/*
* Mark this here until the following segmap_pagecreate
* or segmap_release.
*/
}
else
/*
* FS code may decide not to call segmap_pagecreate and we
* don't invoke segmap_fault via TLB miss, so we have to set
* ref and mod bits in advance.
*/
} else {
hat_setref(pp);
}
return (base);
}
/*
* Find the smap structure corresponding to the
* KPM addr and return it locked.
*/
struct smap *
{
int hashid;
/*
* Assume the last smap used on this cpu is the one needed.
*/
} else {
/*
* Assumption wrong, find the smap on the hash chain.
*/
break;
}
if (smp) {
}
}
if (ppp)
return (smp);
}
#else /* SEGKPM_SUPPORT */
/* segkpm stubs */
/*ARGSUSED*/
static caddr_t
{
return (NULL);
}
/*ARGSUSED*/
struct smap *
{
return (NULL);
}
#endif /* SEGKPM_SUPPORT */