cvs commit: src/sys/boot/pc32/libi386 biosacpi.c src/sys/conf acpi.mk files src/sys/dev/acpica5 Makefile Makefile.inc acdragonfly.h acpi.c acpi_acad.c acpi_button.c acpi_cmbat.c acpi_cpu.c acpi_ec.c acpi_lid.c acpi_resource.c acpi_thermal.c ...

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Fri Jan 19 09:58:32 PST 2007


On Fri, Jan 19, 2007 at 01:45:26PM +0100, Simon 'corecode' Schubert wrote:
> YONETANI Tomokazu wrote:
> >>Uff, now I've got it.
> >>It hangs in OsdCache.c:AcpiOsAcquireObject
> >>
> >>Object = objcache_get(Cache->cache, M_WAITOK);
> 
> Heh.  The ACPI docs are simply not nice enough:
> 
> /*******************************************************************************
> *
> * FUNCTION:    AcpiOsCreateCache
> *
> * PARAMETERS:  CacheName       - Ascii name for the cache
> *              ObjectSize      - Size of each cached object
> *              MaxDepth        - Maximum depth of the cache (in objects)
> *              ReturnCache     - Where the new cache object is returned
> 
> we interpret MaxDepth as "object limit".
> 
> but look what utcache.c/AcpiOsReleaseObject does:
> 
>    /* If cache is full, just free this object */
> 
>    if (Cache->CurrentDepth >= Cache->MaxDepth)
>    {
>        ACPI_FREE (Object);
>        ACPI_MEM_TRACKING (Cache->TotalFreed++);
>    }
> 
>    /* Otherwise put this object back into the cache */
> 
> Quite differently.  Basically MaxDepth is "maximum number of unallocated 
> objects", not "maximum number of allocated objects".  bummer :)

A-ha, good catch.  So what can we do to this problem?  Since
ACPI-CA original version doesn't have an upper limit to
the number of allocated objects anyway, do we just ignore
the MaxDepth parameter and trust our objcache's effectiveness?

Index: Osd/OsdCache.c
===================================================================
RCS file: /home/source/dragonfly/cvs/src/sys/dev/acpica5/Osd/OsdCache.c,v
retrieving revision 1.1
diff -u -p -r1.1 OsdCache.c
--- Osd/OsdCache.c	17 Jan 2007 17:31:19 -0000	1.1
+++ Osd/OsdCache.c	19 Jan 2007 17:22:47 -0000
@@ -52,8 +52,8 @@ AcpiOsCreateCache(char *CacheName, UINT1
 	cache = kmalloc(sizeof(*cache), M_TEMP, M_WAITOK);
 	cache->args.objsize = ObjectSize;
 	cache->args.mtype = M_CACHE;
-	cache->cache = objcache_create(CacheName, MaxDepth, 0, NULL, NULL, NULL,
-	    objcache_malloc_alloc, objcache_malloc_free, &cache->args);
+	cache->cache = objcache_create(CacheName, 0, 0, NULL, NULL,
+	    NULL, objcache_malloc_alloc, objcache_malloc_free, &cache->args);
 	*ReturnCache = cache;
 	return AE_OK;
 }





More information about the Commits mailing list