Use high priority xcall with a softint of an IPL the same as psref class's one

This mitigates undesired delay of psref_target_destroy under load such as heavy
netowrk traffic that loads softint.
This commit is contained in:
ozaki-r 2018-02-01 03:17:00 +00:00
parent d3a1d6fa1b
commit d10d3470ce

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_psref.c,v 1.10 2017/12/28 03:39:48 msaitoh Exp $ */
/* $NetBSD: subr_psref.c,v 1.11 2018/02/01 03:17:00 ozaki-r Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.10 2017/12/28 03:39:48 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.11 2018/02/01 03:17:00 ozaki-r Exp $");
#include <sys/types.h>
#include <sys/condvar.h>
@ -94,6 +94,7 @@ struct psref_class {
kcondvar_t prc_cv;
struct percpu *prc_percpu; /* struct psref_cpu */
ipl_cookie_t prc_iplcookie;
unsigned int prc_xc_flags;
};
/*
@ -124,6 +125,7 @@ psref_class_create(const char *name, int ipl)
mutex_init(&class->prc_lock, MUTEX_DEFAULT, ipl);
cv_init(&class->prc_cv, name);
class->prc_iplcookie = makeiplcookie(ipl);
class->prc_xc_flags = XC_HIGHPRI_IPL(ipl);
return class;
}
@ -434,7 +436,8 @@ psreffed_p(struct psref_target *target, struct psref_class *class)
* Ask all CPUs to say whether they hold a psref to the
* target.
*/
xc_wait(xc_broadcast(0, &psreffed_p_xc, &P, NULL));
xc_wait(xc_broadcast(class->prc_xc_flags, &psreffed_p_xc, &P,
NULL));
} else
psreffed_p_xc(&P, NULL);