Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Feb 2002 17:54:56 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Terry Lambert <tlambert2@mindspring.com>, Alfred Perlstein <alfred@FreeBSD.ORG>, Bosko Milekic <bmilekic@unixdaemons.com>, Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp>, <current@FreeBSD.ORG>, John Baldwin <jhb@FreeBSD.ORG>
Subject:   Re: malloc_bucket() idea (was Re: How to fix malloc.)
Message-ID:  <200202240154.g1O1suv36741@apollo.backplane.com>
References:   <20020224111043.W30980-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
:It's too messy and unfinished (doesn't work right for SMP or irqs >= 16),
:and dificult to untangle from my other patches.  I posted these partial
:ones to attempt to inhibit() recomplication of the current critical*
:functions in directions that I don't want to go :-).
:...
:
:ipending here works much as in RELENG_4.  It is ORed into by sched_ithd()
:if curthread->td_critnest != 0.  Nothing special is needed for pci
:(the ICU masks pending interrupts).
:
:Bruce

    Ok, I have most of it coded up.  Could you explain what 'spending'
    was for?

    I am doing it slightly different then you.  To avoid having to use
    locked instructions I have placed ipending in the thread structure:

void
critical_enter(void)
{
        struct thread *td = curthread;
        ++td->td_critnest;
}

void
critical_exit(void)
{
        struct thread *td = curthread;
        KASSERT(td->td_critnest > 0, ("bad td_critnest value!"));
        if (--td->td_critnest == 0) {
                if (td->td_ipending)
                        unpend();
        }
}

    The apic and icu vector code will do a simple td_critnest test and
    OR the irq bit into td->td_ipending (it conveniently already has 
    the struct thread in %ebx).  And the vector code will also check and
    handle any non-zero td_ipending if critnest is 0, handling the 
    1->0 transition/preemption race.

    I'll post the patch when it gets a little further along.

    How should I deal with fast interrupts?

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202240154.g1O1suv36741>