Bug #923

zdestroy() patch

Added by nthery about 6 years ago. Updated about 6 years ago.

Status:ClosedStart date:
Priority:LowDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Hello,

I know that zalloc() is deprecated but here is anyway a patch that
implements zdestroy() as suggested in:

http://leaf.dragonflybsd.org/mailarchive/bugs/2008-01/msg00032.html

This patch is not thread-safe and assumes that the mp lock is held
while zalloc() and friends are called as stated in:

http://leaf.dragonflybsd.org/mailarchive/kernel/2008-01/msg00045.html

I'll commit it in a few days if there are no objections.

Regarding zalloc() lack of thread safety, I see two options:

1/ Modify the man page and comments in vm_zone.c which currently state
the contrary.

2/ Be defensive and add calls to get_mplock() / release_mplock() in
zalloc() and friends.

In any case, the misleading spinlock (zlock) could be removed too.

I've got a preference for (2). What do you think?

Cheers,
Nicolas

zdestroy.patch Magnifier (8.52 KB) nthery, 01/20/2008 10:19 AM

History

#1 Updated by dillon about 6 years ago

:Hello,
:
:I know that zalloc() is deprecated but here is anyway a patch that
:implements zdestroy() as suggested in:
:
:http://leaf.dragonflybsd.org/mailarchive/bugs/2008-01/msg00032.html
:
:This patch is not thread-safe and assumes that the mp lock is held
:while zalloc() and friends are called as stated in:
:
:http://leaf.dragonflybsd.org/mailarchive/kernel/2008-01/msg00045.html
:
:I'll commit it in a few days if there are no objections.
:
:Regarding zalloc() lack of thread safety, I see two options:

Looks good.

We shouldn't worry too much about thread safety. Only the PV entry
subsystem actually needs to use zalloc() these days. All the other
subsystems could easily be converted to using our OBJCACHE subsystem.

I'm in no rush... it can be done as the SMP work dives into those
subsystems.

-Matt

#2 Updated by nthery about 6 years ago

Committed to HEAD

Also available in: Atom PDF