From owner-freebsd-current Sat Feb 23 17:55: 5 2002 Delivered-To: freebsd-current@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id C4CBE37B402; Sat, 23 Feb 2002 17:54:58 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g1O1suv36741; Sat, 23 Feb 2002 17:54:56 -0800 (PST) (envelope-from dillon) Date: Sat, 23 Feb 2002 17:54:56 -0800 (PST) From: Matthew Dillon Message-Id: <200202240154.g1O1suv36741@apollo.backplane.com> To: Bruce Evans Cc: Terry Lambert , Alfred Perlstein , Bosko Milekic , Seigo Tanimura , , John Baldwin Subject: Re: malloc_bucket() idea (was Re: How to fix malloc.) References: <20020224111043.W30980-100000@gamplex.bde.org> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message