Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Apr 2001 17:20:42 -0700 (PDT)
From:      Matt Dillon <dillon@earth.backplane.com>
To:        Bosko Milekic <bmilekic@technokratis.com>
Cc:        Garrett Rooney <rooneg@electricjellyfish.net>, Alfred Perlstein <alfred@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys mbuf.h src/sys/kern uipc_mbuf.c
Message-ID:  <200104040020.f340Kgi74269@earth.backplane.com>
References:  <200104030315.f333FCX69312@freefall.freebsd.org> <20010403140457.B2952@electricjellyfish.net> <200104031813.f33ID4b58965@earth.backplane.com> <20010403194004.A15434@technokratis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
:	The reason for the removal isn't related to pollution of system
:structures per se (i.e. bloat). There were really only three locks, one
:for each free list.
:	The removal is, the way I see it, a slight pessimization in some
:cases at this moment, due to the increase of contention again, in some cases.
:...

    Ok... hmm.  Since compare-exchange support is mandatory now, why not
    simply use it to implement per-cpu free lists for mbufs that does not
    require any (mutex) locking at all?  This solves the contention problem
    and the interrupt problem.

    e.g. (pseudo code)

    allocMBufHeader()
    {
	struct mbuf *mb;

	while ((mb = PerCpuMBufHeaderBase) != NULL) {
	    if (cmpexchangeptr(&PerCpuMBufHeaderBase, mb, mb->mb_Next) == mb)
		break;
	}
	if (mb == NULL) {
	    slow version
	}
	return(mb);
    }

    freeMBufHeader(mb)
    {
	for (;;) {
	    mb->mb_Next = PerCpuMBufHeaderBase;
	    if (cmpexchangeptr(&PerCpuMBufHeaderBase, mb->mb_Next, mb) == mb->mb_Next)
		break;
	}
    }

						-Matt


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




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