Hi, Jörg

Have you noticed this syscall:  

======================================================================
Declared in <Sysent.c>: 
        /* 131 */ SYSENT_CI("memcntl", memcntl, 6),

Defined in <Memcntl.c>

int
memcntl(caddr_t addr, size_t len, int cmd, caddr_t arg, int attr, int mask) {
........

switch ((uintptr_t)arg) {
case MADV_WILLNEED:
        fc = as_faulta(as, addr, len);
        if (fc) {
                if (FC_CODE(fc) == FC_OBJERR)
                        error = set_errno(FC_ERRNO(fc));
                else if (FC_CODE(fc) == FC_NOMAP)
                        error = set_errno(ENOMEM);
                else
                        error = set_errno(EINVAL);
                return (error);
        }
        break;

case MADV_DONTNEED:
        /*
         * For now, don't need is turned into an as_ctl(MC_SYNC)
         * operation flagged for async invalidate.
         */
        error = as_ctl(as, addr, len, MC_SYNC, attr,
            MS_ASYNC | MS_INVALIDATE, NULL, 0);
        if (error)
                (void) set_errno(error);
        return (error);
...

=================================================================

We can see MADV_WILLNEED indeed causes a early faulting page in (as_faulta). 
Whereas MADV_DONTNEED will flag the page for async invalidate.

Haven't found any callers in the kernel calling into "memcntl" though. Any 
ideas?

Thanks


Peng Du


On Mon, 2009-04-06 at 10:26 +0200, Joerg Schilling wrote:
Peng Du <imdup...@gmail.com> wrote:
> 
> > Hello, experts
> >
> > I have a question about syscall "madvise" 
> > (http://docs.sun.com/app/docs/doc/816-5168/madvise-3c?a=view). I want to 
> > know whether MADV_WILLNEED  and MADV_DONTNEED will affect pageout 
> > decisions. In my intuition, page scanner should try to keep MADV_WILLNEED 
> > pages in physical memory, and prefer MADV_DONTNEED pages for swapping out. 
> 
> I tried to use this 10 years ago in order to make star faster to no avail.
> I would like to see a way to tell Solaris to do read aheads but to remove 
> anything from the cache after it was read once.
> 
> Jörg
>
-- 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to