public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] ACPICA: Remove use of caches in controlled way
@ 2009-05-07 15:52 Alexey Starikovskiy
  2009-05-07 15:52 ` [PATCH 2/4] ACPICA: Remove cache code Alexey Starikovskiy
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Alexey Starikovskiy @ 2009-05-07 15:52 UTC (permalink / raw)
  To: Moore, Robert; +Cc: Linux-acpi

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

 source/components/utilities/utcache.c |   99 +++++----------------------------
 1 files changed, 14 insertions(+), 85 deletions(-)


diff --git a/source/components/utilities/utcache.c b/source/components/utilities/utcache.c
index aabc0a2..d08d520 100644
--- a/source/components/utilities/utcache.c
+++ b/source/components/utilities/utcache.c
@@ -287,49 +287,15 @@ AcpiOsReleaseObject (
     ACPI_MEMORY_LIST        *Cache,
     void                    *Object)
 {
-    ACPI_STATUS             Status;
-
-
     ACPI_FUNCTION_ENTRY ();
 
-
     if (!Cache || !Object)
     {
         return (AE_BAD_PARAMETER);
     }
 
-    /* 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 */
-
-    else
-    {
-        Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
-        if (ACPI_FAILURE (Status))
-        {
-            return (Status);
-        }
-
-        /* Mark the object as cached */
-
-        ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
-        ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
-
-        /* Put the object at the head of the cache list */
-
-        * (ACPI_CAST_INDIRECT_PTR (char,
-            &(((char *) Object)[Cache->LinkOffset]))) = Cache->ListHead;
-        Cache->ListHead = Object;
-        Cache->CurrentDepth++;
-
-        (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
-    }
+    ACPI_FREE (Object);
+    ACPI_MEM_TRACKING (Cache->TotalFreed++);
 
     return (AE_OK);
 }
@@ -353,8 +319,6 @@ AcpiOsAcquireObject (
     ACPI_MEMORY_LIST        *Cache)
 {
     ACPI_STATUS             Status;
-    void                    *Object;
-
 
     ACPI_FUNCTION_NAME (OsAcquireObject);
 
@@ -372,61 +336,26 @@ AcpiOsAcquireObject (
 
     ACPI_MEM_TRACKING (Cache->Requests++);
 
-    /* Check the cache first */
+    /* The cache is empty, create a new object */
 
-    if (Cache->ListHead)
-    {
-        /* There is an object available, use it */
-
-        Object = Cache->ListHead;
-        Cache->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
-                                &(((char *) Object)[Cache->LinkOffset])));
-
-        Cache->CurrentDepth--;
-
-        ACPI_MEM_TRACKING (Cache->Hits++);
-        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-            "Object %p from %s cache\n", Object, Cache->ListName));
-
-        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
-        if (ACPI_FAILURE (Status))
-        {
-            return (NULL);
-        }
-
-        /* Clear (zero) the previously used Object */
-
-        ACPI_MEMSET (Object, 0, Cache->ObjectSize);
-    }
-    else
-    {
-        /* The cache is empty, create a new object */
-
-        ACPI_MEM_TRACKING (Cache->TotalAllocated++);
+    ACPI_MEM_TRACKING (Cache->TotalAllocated++);
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
-        if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache->MaxOccupied)
-        {
-            Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed;
-        }
+    if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache->MaxOccupied)
+    {
+        Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed;
+    }
 #endif
 
-        /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
+    /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
 
-        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
-        if (ACPI_FAILURE (Status))
-        {
-            return (NULL);
-        }
-
-        Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
-        if (!Object)
-        {
-            return (NULL);
-        }
+    Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+    if (ACPI_FAILURE (Status))
+    {
+        return (NULL);
     }
 
-    return (Object);
+    return ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
 }
 #endif /* ACPI_USE_LOCAL_CACHE */
 


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] ACPICA: Remove cache code
  2009-05-07 15:52 [PATCH 1/4] ACPICA: Remove use of caches in controlled way Alexey Starikovskiy
@ 2009-05-07 15:52 ` Alexey Starikovskiy
  2009-05-07 15:52 ` [PATCH 3/4] ACPICA: Drop Operand cache Alexey Starikovskiy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Alexey Starikovskiy @ 2009-05-07 15:52 UTC (permalink / raw)
  To: Moore, Robert; +Cc: Linux-acpi

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

 source/components/debugger/dbexec.c    |   73 ------
 source/components/debugger/dbstats.c   |   38 ---
 source/components/namespace/nsalloc.c  |    6 -
 source/components/parser/psutils.c     |    8 -
 source/components/utilities/utalloc.c  |   61 -----
 source/components/utilities/utcache.c  |  362 --------------------------------
 source/components/utilities/utobject.c |    4 
 source/components/utilities/utstate.c  |    4 
 source/components/utilities/utxface.c  |   35 ---
 source/include/acconfig.h              |    8 -
 source/include/acglobal.h              |    8 -
 source/include/acobject.h              |   12 -
 source/include/acpiosxf.h              |   29 ---
 source/include/actypes.h               |   10 -
 source/include/platform/acenv.h        |    7 -
 source/include/platform/acfreebsd.h    |    1 
 source/include/platform/aclinux.h      |    1 
 source/include/platform/acos2.h        |    1 
 source/tools/acpisrc/astable.c         |    2 
 19 files changed, 12 insertions(+), 658 deletions(-)
 delete mode 100644 source/components/utilities/utcache.c


diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c
index eb39b37..c0bdb84 100644
--- a/source/components/debugger/dbexec.c
+++ b/source/components/debugger/dbexec.c
@@ -138,10 +138,6 @@ static void
 AcpiDbExecuteSetup (
     ACPI_DB_METHOD_INFO     *Info);
 
-static UINT32
-AcpiDbGetOutstandingAllocations (
-    void);
-
 static void ACPI_SYSTEM_XFACE
 AcpiDbMethodThread (
     void                    *Context);
@@ -323,48 +319,6 @@ AcpiDbExecuteSetup (
 }
 
 
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-UINT32
-AcpiDbGetCacheInfo (
-    ACPI_MEMORY_LIST        *Cache)
-{
-
-    return (Cache->TotalAllocated - Cache->TotalFreed - Cache->CurrentDepth);
-}
-#endif
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiDbGetOutstandingAllocations
- *
- * PARAMETERS:  None
- *
- * RETURN:      Current global allocation count minus cache entries
- *
- * DESCRIPTION: Determine the current number of "outstanding" allocations --
- *              those allocations that have not been freed and also are not
- *              in one of the various object caches.
- *
- ******************************************************************************/
-
-static UINT32
-AcpiDbGetOutstandingAllocations (
-    void)
-{
-    UINT32                  Outstanding = 0;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
-    Outstanding += AcpiDbGetCacheInfo (AcpiGbl_StateCache);
-    Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeCache);
-    Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeExtCache);
-    Outstanding += AcpiDbGetCacheInfo (AcpiGbl_OperandCache);
-#endif
-
-    return (Outstanding);
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiDbExecutionWalk
@@ -442,17 +396,6 @@ AcpiDbExecute (
     ACPI_BUFFER             ReturnObj;
     char                    *NameString;
 
-
-#ifdef ACPI_DEBUG_OUTPUT
-    UINT32                  PreviousAllocations;
-    UINT32                  Allocations;
-
-
-    /* Memory allocation tracking */
-
-    PreviousAllocations = AcpiDbGetOutstandingAllocations ();
-#endif
-
     if (*Name == '*')
     {
         (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT,
@@ -489,22 +432,6 @@ AcpiDbExecute (
      */
     AcpiOsSleep ((ACPI_INTEGER) 10);
 
-
-#ifdef ACPI_DEBUG_OUTPUT
-
-    /* Memory allocation tracking */
-
-    Allocations = AcpiDbGetOutstandingAllocations () - PreviousAllocations;
-
-    AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
-
-    if (Allocations > 0)
-    {
-        AcpiOsPrintf ("Outstanding: 0x%X allocations after execution\n",
-                        Allocations);
-    }
-#endif
-
     if (ACPI_FAILURE (Status))
     {
         AcpiOsPrintf ("Execution of %s failed with status %s\n",
diff --git a/source/components/debugger/dbstats.c b/source/components/debugger/dbstats.c
index f2f2f78..4ae3f65 100644
--- a/source/components/debugger/dbstats.c
+++ b/source/components/debugger/dbstats.c
@@ -189,9 +189,6 @@ static void
 AcpiDbListInfo (
     ACPI_MEMORY_LIST        *List)
 {
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-    UINT32                  Outstanding;
-#endif
 
     AcpiOsPrintf ("\n%s\n", List->ListName);
 
@@ -207,41 +204,6 @@ AcpiDbListInfo (
             (List->CurrentDepth * List->ObjectSize));
     }
 
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-    if (List->MaxDepth > 0)
-    {
-        AcpiOsPrintf (
-            "    Cache: [Requests Hits Misses ObjSize]             %8.2X %8.2X %8.2X %8.2X\n",
-            List->Requests,
-            List->Hits,
-            List->Requests - List->Hits,
-            List->ObjectSize);
-    }
-
-    Outstanding = AcpiDbGetCacheInfo (List);
-
-    if (List->ObjectSize)
-    {
-        AcpiOsPrintf (
-            "    Mem:   [Alloc    Free Max    CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X %8.2X\n",
-            List->TotalAllocated,
-            List->TotalFreed,
-            List->MaxOccupied,
-            Outstanding * List->ObjectSize,
-            Outstanding);
-    }
-    else
-    {
-        AcpiOsPrintf (
-            "    Mem:   [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n",
-            List->TotalAllocated,
-            List->TotalFreed,
-            List->MaxOccupied,
-            List->CurrentTotalSize,
-            Outstanding,
-            List->TotalSize);
-    }
-#endif
 }
 #endif
 
diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c
index 1158c36..a1b43b7 100644
--- a/source/components/namespace/nsalloc.c
+++ b/source/components/namespace/nsalloc.c
@@ -150,7 +150,7 @@ AcpiNsCreateNode (
     ACPI_FUNCTION_TRACE (NsCreateNode);
 
 
-    Node = AcpiOsAcquireObject (AcpiGbl_NamespaceCache);
+    Node = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE));
     if (!Node)
     {
         return_PTR (NULL);
@@ -242,7 +242,7 @@ AcpiNsDeleteNode (
     /* Detach an object if there is one, then delete the node */
 
     AcpiNsDetachObject (Node);
-    (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node);
+    ACPI_FREE (Node);
     return_VOID;
 }
 
@@ -398,7 +398,7 @@ AcpiNsDeleteChildren (
 
         /* Now we can delete the node */
 
-        (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, ChildNode);
+        ACPI_FREE (ChildNode);
 
         /* And move on to the next child in the list */
 
diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c
index 42f2b01..116e388 100644
--- a/source/components/parser/psutils.c
+++ b/source/components/parser/psutils.c
@@ -232,13 +232,13 @@ AcpiPsAllocOp (
     {
         /* The generic op (default) is by far the most common (16 to 1) */
 
-        Op = AcpiOsAcquireObject (AcpiGbl_PsNodeCache);
+        Op = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PARSE_OBJ_COMMON));
     }
     else
     {
         /* Extended parseop */
 
-        Op = AcpiOsAcquireObject (AcpiGbl_PsNodeExtCache);
+        Op = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PARSE_OBJ_NAMED));
     }
 
     /* Initialize the Op */
@@ -280,11 +280,11 @@ AcpiPsFreeOp (
 
     if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
     {
-        (void) AcpiOsReleaseObject (AcpiGbl_PsNodeCache, Op);
+        ACPI_FREE (Op);
     }
     else
     {
-        (void) AcpiOsReleaseObject (AcpiGbl_PsNodeExtCache, Op);
+        ACPI_FREE (Op);
     }
 }
 
diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c
index a66b940..26ca984 100644
--- a/source/components/utilities/utalloc.c
+++ b/source/components/utilities/utalloc.c
@@ -139,48 +139,8 @@ ACPI_STATUS
 AcpiUtCreateCaches (
     void)
 {
-    ACPI_STATUS             Status;
-
-
-    /* Object Caches, for frequently used objects */
-
-    Status = AcpiOsCreateCache ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE),
-                ACPI_MAX_NAMESPACE_CACHE_DEPTH, &AcpiGbl_NamespaceCache);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-    Status = AcpiOsCreateCache ("Acpi-State", sizeof (ACPI_GENERIC_STATE),
-                ACPI_MAX_STATE_CACHE_DEPTH, &AcpiGbl_StateCache);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-    Status = AcpiOsCreateCache ("Acpi-Parse", sizeof (ACPI_PARSE_OBJ_COMMON),
-                ACPI_MAX_PARSE_CACHE_DEPTH, &AcpiGbl_PsNodeCache);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-    Status = AcpiOsCreateCache ("Acpi-ParseExt", sizeof (ACPI_PARSE_OBJ_NAMED),
-                ACPI_MAX_EXTPARSE_CACHE_DEPTH, &AcpiGbl_PsNodeExtCache);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-    Status = AcpiOsCreateCache ("Acpi-Operand", sizeof (ACPI_OPERAND_OBJECT),
-                ACPI_MAX_OBJECT_CACHE_DEPTH, &AcpiGbl_OperandCache);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
+    ACPI_STATUS             Status;
 
     /* Memory allocation lists */
 
@@ -227,25 +187,6 @@ AcpiUtDeleteCaches (
         ACPI_STRCPY (Buffer, "MEMORY");
         (void) AcpiDbDisplayStatistics (Buffer);
     }
-#endif
-
-    (void) AcpiOsDeleteCache (AcpiGbl_NamespaceCache);
-    AcpiGbl_NamespaceCache = NULL;
-
-    (void) AcpiOsDeleteCache (AcpiGbl_StateCache);
-    AcpiGbl_StateCache = NULL;
-
-    (void) AcpiOsDeleteCache (AcpiGbl_OperandCache);
-    AcpiGbl_OperandCache = NULL;
-
-    (void) AcpiOsDeleteCache (AcpiGbl_PsNodeCache);
-    AcpiGbl_PsNodeCache = NULL;
-
-    (void) AcpiOsDeleteCache (AcpiGbl_PsNodeExtCache);
-    AcpiGbl_PsNodeExtCache = NULL;
-
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
     /* Debug only - display leftover memory allocation, if any */
 
diff --git a/source/components/utilities/utcache.c b/source/components/utilities/utcache.c
deleted file mode 100644
index d08d520..0000000
--- a/source/components/utilities/utcache.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/******************************************************************************
- *
- * Module Name: utcache - local cache allocation routines
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
- * All rights reserved.
- *
- * 2. License
- *
- * 2.1. This is your license from Intel Corp. under its intellectual property
- * rights.  You may have additional license terms from the party that provided
- * you this software, covering your right to use that party's intellectual
- * property rights.
- *
- * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
- * copy of the source code appearing in this file ("Covered Code") an
- * irrevocable, perpetual, worldwide license under Intel's copyrights in the
- * base code distributed originally by Intel ("Original Intel Code") to copy,
- * make derivatives, distribute, use and display any portion of the Covered
- * Code in any form, with the right to sublicense such rights; and
- *
- * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
- * license (with the right to sublicense), under only those claims of Intel
- * patents that are infringed by the Original Intel Code, to make, use, sell,
- * offer to sell, and import the Covered Code and derivative works thereof
- * solely to the minimum extent necessary to exercise the above copyright
- * license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code.  No other license or right
- * is granted directly or by implication, estoppel or otherwise;
- *
- * The above copyright and patent license is granted only if the following
- * conditions are met:
- *
- * 3. Conditions
- *
- * 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification with rights to further distribute source must include
- * the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision.  In addition,
- * Licensee must cause all Covered Code to which Licensee contributes to
- * contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change.  Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee.  Licensee
- * must include a prominent statement that the modification is derived,
- * directly or indirectly, from Original Intel Code.
- *
- * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
- * Redistribution of source code of any substantial portion of the Covered
- * Code or modification without rights to further distribute source must
- * include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution.  In
- * addition, Licensee may not authorize further sublicense of source of any
- * portion of the Covered Code, and must include terms to the effect that the
- * license from Licensee to its licensee is limited to the intellectual
- * property embodied in the software Licensee provides to its licensee, and
- * not to intellectual property embodied in modifications its licensee may
- * make.
- *
- * 3.3. Redistribution of Executable. Redistribution in executable form of any
- * substantial portion of the Covered Code or modification must reproduce the
- * above Copyright Notice, and the following Disclaimer and Export Compliance
- * provision in the documentation and/or other materials provided with the
- * distribution.
- *
- * 3.4. Intel retains all right, title, and interest in and to the Original
- * Intel Code.
- *
- * 3.5. Neither the name Intel nor any other trademark owned or controlled by
- * Intel shall be used in advertising or otherwise to promote the sale, use or
- * other dealings in products derived from or relating to the Covered Code
- * without prior written authorization from Intel.
- *
- * 4. Disclaimer and Export Compliance
- *
- * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
- * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
- * PARTICULAR PURPOSE.
- *
- * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
- * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
- * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
- * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
- * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
- * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
- * LIMITED REMEDY.
- *
- * 4.3. Licensee shall not export, either directly or indirectly, any of this
- * software or system incorporating such software without first obtaining any
- * required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government.  In the
- * event Licensee exports any such software from the United States or
- * re-exports any such software from a foreign destination, Licensee shall
- * ensure that the distribution and export/re-export of the software is in
- * compliance with all laws, regulations, orders, or other restrictions of the
- * U.S. Export Administration Regulations. Licensee agrees that neither it nor
- * any of its subsidiaries will export/re-export any technical data, process,
- * software, or service, directly or indirectly, to any country for which the
- * United States government or any agency thereof requires an export license,
- * other governmental approval, or letter of assurance, without first obtaining
- * such license, approval or letter.
- *
- *****************************************************************************/
-
-#define __UTCACHE_C__
-
-#include "acpi.h"
-#include "accommon.h"
-
-#define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utcache")
-
-
-#ifdef ACPI_USE_LOCAL_CACHE
-/*******************************************************************************
- *
- * 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
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a cache object
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiOsCreateCache (
-    char                    *CacheName,
-    UINT16                  ObjectSize,
-    UINT16                  MaxDepth,
-    ACPI_MEMORY_LIST        **ReturnCache)
-{
-    ACPI_MEMORY_LIST        *Cache;
-
-
-    ACPI_FUNCTION_ENTRY ();
-
-
-    if (!CacheName || !ReturnCache || (ObjectSize < 16))
-    {
-        return (AE_BAD_PARAMETER);
-    }
-
-    /* Create the cache object */
-
-    Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST));
-    if (!Cache)
-    {
-        return (AE_NO_MEMORY);
-    }
-
-    /* Populate the cache object and return it */
-
-    ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
-    Cache->LinkOffset = 8;
-    Cache->ListName   = CacheName;
-    Cache->ObjectSize = ObjectSize;
-    Cache->MaxDepth   = MaxDepth;
-
-    *ReturnCache = Cache;
-    return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiOsPurgeCache
- *
- * PARAMETERS:  Cache           - Handle to cache object
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Free all objects within the requested cache.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiOsPurgeCache (
-    ACPI_MEMORY_LIST        *Cache)
-{
-    char                    *Next;
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_ENTRY ();
-
-
-    if (!Cache)
-    {
-        return (AE_BAD_PARAMETER);
-    }
-
-    Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-    /* Walk the list of objects in this cache */
-
-    while (Cache->ListHead)
-    {
-        /* Delete and unlink one cached state object */
-
-        Next = *(ACPI_CAST_INDIRECT_PTR (char,
-                    &(((char *) Cache->ListHead)[Cache->LinkOffset])));
-        ACPI_FREE (Cache->ListHead);
-
-        Cache->ListHead = Next;
-        Cache->CurrentDepth--;
-    }
-
-    (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
-    return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiOsDeleteCache
- *
- * PARAMETERS:  Cache           - Handle to cache object
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Free all objects within the requested cache and delete the
- *              cache object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiOsDeleteCache (
-    ACPI_MEMORY_LIST        *Cache)
-{
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_ENTRY ();
-
-
-   /* Purge all objects in the cache */
-
-    Status = AcpiOsPurgeCache (Cache);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-    /* Now we can delete the cache object */
-
-    AcpiOsFree (Cache);
-    return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiOsReleaseObject
- *
- * PARAMETERS:  Cache       - Handle to cache object
- *              Object      - The object to be released
- *
- * RETURN:      None
- *
- * DESCRIPTION: Release an object to the specified cache.  If cache is full,
- *              the object is deleted.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiOsReleaseObject (
-    ACPI_MEMORY_LIST        *Cache,
-    void                    *Object)
-{
-    ACPI_FUNCTION_ENTRY ();
-
-    if (!Cache || !Object)
-    {
-        return (AE_BAD_PARAMETER);
-    }
-
-    ACPI_FREE (Object);
-    ACPI_MEM_TRACKING (Cache->TotalFreed++);
-
-    return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiOsAcquireObject
- *
- * PARAMETERS:  Cache           - Handle to cache object
- *
- * RETURN:      the acquired object.  NULL on error
- *
- * DESCRIPTION: Get an object from the specified cache.  If cache is empty,
- *              the object is allocated.
- *
- ******************************************************************************/
-
-void *
-AcpiOsAcquireObject (
-    ACPI_MEMORY_LIST        *Cache)
-{
-    ACPI_STATUS             Status;
-
-    ACPI_FUNCTION_NAME (OsAcquireObject);
-
-
-    if (!Cache)
-    {
-        return (NULL);
-    }
-
-    Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
-    if (ACPI_FAILURE (Status))
-    {
-        return (NULL);
-    }
-
-    ACPI_MEM_TRACKING (Cache->Requests++);
-
-    /* The cache is empty, create a new object */
-
-    ACPI_MEM_TRACKING (Cache->TotalAllocated++);
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-    if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache->MaxOccupied)
-    {
-        Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed;
-    }
-#endif
-
-    /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
-
-    Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
-    if (ACPI_FAILURE (Status))
-    {
-        return (NULL);
-    }
-
-    return ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
-}
-#endif /* ACPI_USE_LOCAL_CACHE */
-
-
diff --git a/source/components/utilities/utobject.c b/source/components/utilities/utobject.c
index e38d2b2..4d2c64c 100644
--- a/source/components/utilities/utobject.c
+++ b/source/components/utilities/utobject.c
@@ -471,7 +471,7 @@ AcpiUtAllocateObjectDescDbg (
     ACPI_FUNCTION_TRACE (UtAllocateObjectDescDbg);
 
 
-    Object = AcpiOsAcquireObject (AcpiGbl_OperandCache);
+    Object = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_OPERAND_OBJECT));
     if (!Object)
     {
         ACPI_ERROR ((ModuleName, LineNumber,
@@ -520,7 +520,7 @@ AcpiUtDeleteObjectDesc (
         return_VOID;
     }
 
-    (void) AcpiOsReleaseObject (AcpiGbl_OperandCache, Object);
+    ACPI_FREE (Object);
     return_VOID;
 }
 
diff --git a/source/components/utilities/utstate.c b/source/components/utilities/utstate.c
index 245ca02..1d98853 100644
--- a/source/components/utilities/utstate.c
+++ b/source/components/utilities/utstate.c
@@ -250,7 +250,7 @@ AcpiUtCreateGenericState (
     ACPI_FUNCTION_ENTRY ();
 
 
-    State = AcpiOsAcquireObject (AcpiGbl_StateCache);
+    State = ACPI_ALLOCATE_ZEROED (sizeof(ACPI_GENERIC_STATE));
     if (State)
     {
         /* Initialize */
@@ -462,7 +462,7 @@ AcpiUtDeleteGenericState (
 
     if (State)
     {
-        (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State);
+        ACPI_FREE (State);
     }
     return_VOID;
 }
diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c
index 4207f3d..17477cc 100644
--- a/source/components/utilities/utxface.c
+++ b/source/components/utilities/utxface.c
@@ -413,13 +413,6 @@ AcpiInitializeObjects (
         }
     }
 
-    /*
-     * Empty the caches (delete the cached objects) on the assumption that
-     * the table load filled them up more than they will be at runtime --
-     * thus wasting non-paged memory.
-     */
-    Status = AcpiPurgeCachedObjects ();
-
     AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK;
     return_ACPI_STATUS (Status);
 }
@@ -679,33 +672,5 @@ AcpiInstallInitializationHandler (
 
 ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler)
 
-
-/*****************************************************************************
- *
- * FUNCTION:    AcpiPurgeCachedObjects
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Empty all caches (delete the cached objects)
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiPurgeCachedObjects (
-    void)
-{
-    ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects);
-
-    (void) AcpiOsPurgeCache (AcpiGbl_StateCache);
-    (void) AcpiOsPurgeCache (AcpiGbl_OperandCache);
-    (void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache);
-    (void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache);
-    return_ACPI_STATUS (AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects)
-
 #endif /* ACPI_ASL_COMPILER */
 
diff --git a/source/include/acconfig.h b/source/include/acconfig.h
index 7b458cc..c8d1767 100644
--- a/source/include/acconfig.h
+++ b/source/include/acconfig.h
@@ -144,14 +144,6 @@
  */
 #define ACPI_OS_NAME                    "Microsoft Windows NT"
 
-/* Maximum objects in the various object caches */
-
-#define ACPI_MAX_STATE_CACHE_DEPTH      96          /* State objects */
-#define ACPI_MAX_PARSE_CACHE_DEPTH      96          /* Parse tree objects */
-#define ACPI_MAX_EXTPARSE_CACHE_DEPTH   96          /* Parse tree objects */
-#define ACPI_MAX_OBJECT_CACHE_DEPTH     96          /* Interpreter operand objects */
-#define ACPI_MAX_NAMESPACE_CACHE_DEPTH  96          /* Namespace objects */
-
 /*
  * Should the subsystem abort the loading of an ACPI table if the
  * table checksum is incorrect?
diff --git a/source/include/acglobal.h b/source/include/acglobal.h
index 827a394..cd73f4f 100644
--- a/source/include/acglobal.h
+++ b/source/include/acglobal.h
@@ -258,14 +258,6 @@ ACPI_EXTERN ACPI_RW_LOCK                AcpiGbl_NamespaceRwLock;
  *
  ****************************************************************************/
 
-/* Object caches */
-
-ACPI_EXTERN ACPI_CACHE_T               *AcpiGbl_NamespaceCache;
-ACPI_EXTERN ACPI_CACHE_T               *AcpiGbl_StateCache;
-ACPI_EXTERN ACPI_CACHE_T               *AcpiGbl_PsNodeCache;
-ACPI_EXTERN ACPI_CACHE_T               *AcpiGbl_PsNodeExtCache;
-ACPI_EXTERN ACPI_CACHE_T               *AcpiGbl_OperandCache;
-
 /* Global handlers */
 
 ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER  AcpiGbl_DeviceNotify;
diff --git a/source/include/acobject.h b/source/include/acobject.h
index 5941859..a82e07d 100644
--- a/source/include/acobject.h
+++ b/source/include/acobject.h
@@ -540,17 +540,6 @@ typedef struct acpi_object_data
 
 } ACPI_OBJECT_DATA;
 
-
-/* Structure used when objects are cached for reuse */
-
-typedef struct acpi_object_cache_list
-{
-    ACPI_OBJECT_COMMON_HEADER
-    union acpi_operand_object       *Next;              /* Link for object cache and internal lists*/
-
-} ACPI_OBJECT_CACHE_LIST;
-
-
 /******************************************************************************
  *
  * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
@@ -583,7 +572,6 @@ typedef union acpi_operand_object
     ACPI_OBJECT_REFERENCE               Reference;
     ACPI_OBJECT_EXTRA                   Extra;
     ACPI_OBJECT_DATA                    Data;
-    ACPI_OBJECT_CACHE_LIST              Cache;
 
     /*
      * Add namespace node to union in order to simplify code that accepts both
diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h
index 730057d..ce63187 100644
--- a/source/include/acpiosxf.h
+++ b/source/include/acpiosxf.h
@@ -283,35 +283,6 @@ AcpiOsGetPhysicalAddress (
     void                    *LogicalAddress,
     ACPI_PHYSICAL_ADDRESS   *PhysicalAddress);
 
-
-/*
- * Memory/Object Cache
- */
-ACPI_STATUS
-AcpiOsCreateCache (
-    char                    *CacheName,
-    UINT16                  ObjectSize,
-    UINT16                  MaxDepth,
-    ACPI_CACHE_T            **ReturnCache);
-
-ACPI_STATUS
-AcpiOsDeleteCache (
-    ACPI_CACHE_T            *Cache);
-
-ACPI_STATUS
-AcpiOsPurgeCache (
-    ACPI_CACHE_T            *Cache);
-
-void *
-AcpiOsAcquireObject (
-    ACPI_CACHE_T            *Cache);
-
-ACPI_STATUS
-AcpiOsReleaseObject (
-    ACPI_CACHE_T            *Cache,
-    void                    *Object);
-
-
 /*
  * Interrupt handlers
  */
diff --git a/source/include/actypes.h b/source/include/actypes.h
index 8f970d9..9885f8a 100644
--- a/source/include/actypes.h
+++ b/source/include/actypes.h
@@ -298,16 +298,6 @@ typedef UINT32                          ACPI_PHYSICAL_ADDRESS;
 #define ACPI_CPU_FLAGS                  ACPI_SIZE
 #endif
 
-/* Object returned from AcpiOsCreateCache */
-
-#ifndef ACPI_CACHE_T
-#ifdef ACPI_USE_LOCAL_CACHE
-#define ACPI_CACHE_T                    ACPI_MEMORY_LIST
-#else
-#define ACPI_CACHE_T                    void *
-#endif
-#endif
-
 /*
  * Synchronization objects - Mutexes, Semaphores, and SpinLocks
  */
diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h
index 58cb03b..7691f27 100644
--- a/source/include/platform/acenv.h
+++ b/source/include/platform/acenv.h
@@ -159,17 +159,10 @@
 #define ACPI_DBG_TRACK_ALLOCATIONS
 #endif
 
-/* Linkable ACPICA library */
-
-#ifdef ACPI_LIBRARY
-#define ACPI_USE_LOCAL_CACHE
-#endif
-
 /* Common for all ACPICA applications */
 
 #ifdef ACPI_APPLICATION
 #define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_USE_LOCAL_CACHE
 #endif
 
 /* Common debug support */
diff --git a/source/include/platform/acfreebsd.h b/source/include/platform/acfreebsd.h
index 3e438aa..5ea7795 100644
--- a/source/include/platform/acfreebsd.h
+++ b/source/include/platform/acfreebsd.h
@@ -125,7 +125,6 @@
 
 #define ACPI_THREAD_ID                  lwpid_t
 #define ACPI_UINTPTR_T                  uintptr_t
-#define ACPI_USE_LOCAL_CACHE
 #define __cdecl
 
 #ifdef _KERNEL
diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h
index c6f868c..0165d2d 100644
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -144,7 +144,6 @@
 #define ACPI_EXPORT_SYMBOL(symbol)  EXPORT_SYMBOL(symbol);
 #define strtoul                     simple_strtoul
 
-#define ACPI_CACHE_T                struct kmem_cache
 #define ACPI_SPINLOCK               spinlock_t *
 #define ACPI_CPU_FLAGS              unsigned long
 #define ACPI_THREAD_ID              struct task_struct *
diff --git a/source/include/platform/acos2.h b/source/include/platform/acos2.h
index 21e3373..5fea8c2 100644
--- a/source/include/platform/acos2.h
+++ b/source/include/platform/acos2.h
@@ -165,7 +165,6 @@ unsigned short OSPMReleaseGlobalLock (void *);
 #endif
 
 #ifndef ACPI_ASL_COMPILER
-#define ACPI_USE_LOCAL_CACHE
 #undef ACPI_DEBUGGER
 #endif
 
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index b813551..d958bb6 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -253,7 +253,6 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {
     {"ACPI_BIT_REGISTER_INFO",              SRC_TYPE_STRUCT},
     {"ACPI_BUFFER",                         SRC_TYPE_STRUCT},
     {"ACPI_BUS_ATTRIBUTE",                  SRC_TYPE_STRUCT},
-    {"ACPI_CACHE_T",                        SRC_TYPE_SIMPLE},
     {"ACPI_COMMON_FACS",                    SRC_TYPE_STRUCT},
     {"ACPI_COMMON_STATE",                   SRC_TYPE_STRUCT},
     {"ACPI_COMMON_DESCRIPTOR",              SRC_TYPE_STRUCT},
@@ -335,7 +334,6 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {
     {"ACPI_OBJECT_BANK_FIELD",              SRC_TYPE_STRUCT},
     {"ACPI_OBJECT_BUFFER",                  SRC_TYPE_STRUCT},
     {"ACPI_OBJECT_BUFFER_FIELD",            SRC_TYPE_STRUCT},
-    {"ACPI_OBJECT_CACHE_LIST",              SRC_TYPE_STRUCT},
     {"ACPI_OBJECT_COMMON",                  SRC_TYPE_STRUCT},
     {"ACPI_OBJECT_DATA",                    SRC_TYPE_STRUCT},
     {"ACPI_OBJECT_DEVICE",                  SRC_TYPE_STRUCT},


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] ACPICA: Drop Operand cache
  2009-05-07 15:52 [PATCH 1/4] ACPICA: Remove use of caches in controlled way Alexey Starikovskiy
  2009-05-07 15:52 ` [PATCH 2/4] ACPICA: Remove cache code Alexey Starikovskiy
@ 2009-05-07 15:52 ` Alexey Starikovskiy
  2009-05-07 15:52 ` [PATCH 4/4] ACPICA: Delete NextObject pointer Alexey Starikovskiy
  2009-05-11  8:14 ` [PATCH 1/4] ACPICA: Remove use of caches in controlled way Lin Ming
  3 siblings, 0 replies; 8+ messages in thread
From: Alexey Starikovskiy @ 2009-05-07 15:52 UTC (permalink / raw)
  To: Moore, Robert; +Cc: Linux-acpi

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

 source/components/debugger/dbexec.c          |    1 
 source/components/debugger/dbstats.c         |    7 -
 source/components/dispatcher/dsfield.c       |    6 -
 source/components/dispatcher/dsopcode.c      |   20 +--
 source/components/events/evregion.c          |   38 +-----
 source/components/events/evrgnini.c          |   12 --
 source/components/executer/excreate.c        |    7 -
 source/components/executer/exprep.c          |    6 -
 source/components/namespace/nsobject.c       |   33 -----
 source/components/utilities/utcopy.c         |    2 
 source/components/utilities/utdelete.c       |   38 ------
 source/components/utilities/utobject.c       |  164 ++++++++++++--------------
 source/include/acnamesp.h                    |    4 -
 source/include/acobject.h                    |   29 +----
 source/include/actypes.h                     |    1 
 source/include/acutils.h                     |    2 
 source/os_specific/service_layers/osunixxf.c |    2 
 17 files changed, 108 insertions(+), 264 deletions(-)


diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c
index c0bdb84..18c5697 100644
--- a/source/components/debugger/dbexec.c
+++ b/source/components/debugger/dbexec.c
@@ -318,7 +318,6 @@ AcpiDbExecuteSetup (
     }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiDbExecutionWalk
diff --git a/source/components/debugger/dbstats.c b/source/components/debugger/dbstats.c
index 4ae3f65..eb0f601 100644
--- a/source/components/debugger/dbstats.c
+++ b/source/components/debugger/dbstats.c
@@ -268,10 +268,7 @@ AcpiDbEnumerateObject (
 
     case ACPI_TYPE_BUFFER_FIELD:
 
-        if (AcpiNsGetSecondaryObject (ObjDesc))
-        {
-            AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
-        }
+        AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
         break;
 
     case ACPI_TYPE_REGION:
@@ -493,7 +490,6 @@ AcpiDbDisplayStatistics (
 
 #ifdef ACPI_USE_LOCAL_CACHE
         AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n");
-        AcpiDbListInfo (AcpiGbl_OperandCache);
         AcpiDbListInfo (AcpiGbl_PsNodeCache);
         AcpiDbListInfo (AcpiGbl_PsNodeExtCache);
         AcpiDbListInfo (AcpiGbl_StateCache);
@@ -544,7 +540,6 @@ AcpiDbDisplayStatistics (
         AcpiOsPrintf ("Reference        %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
         AcpiOsPrintf ("Notify           %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
         AcpiOsPrintf ("AddressSpace     %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
-        AcpiOsPrintf ("Extra            %3d\n", sizeof (ACPI_OBJECT_EXTRA));
         AcpiOsPrintf ("Data             %3d\n", sizeof (ACPI_OBJECT_DATA));
 
         AcpiOsPrintf ("\n");
diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c
index 2d8e586..150651b 100644
--- a/source/components/dispatcher/dsfield.c
+++ b/source/components/dispatcher/dsfield.c
@@ -164,7 +164,6 @@ AcpiDsCreateBufferField (
     ACPI_NAMESPACE_NODE     *Node;
     ACPI_STATUS             Status;
     ACPI_OPERAND_OBJECT     *ObjDesc;
-    ACPI_OPERAND_OBJECT     *SecondDesc = NULL;
     UINT32                  Flags;
 
 
@@ -266,9 +265,8 @@ AcpiDsCreateBufferField (
      * Remember location in AML stream of the field unit opcode and operands --
      * since the buffer and index operands must be evaluated.
      */
-    SecondDesc                  = ObjDesc->Common.NextObject;
-    SecondDesc->Extra.AmlStart  = Op->Named.Data;
-    SecondDesc->Extra.AmlLength = Op->Named.Length;
+    ObjDesc->BufferField.AmlStart  = Op->Named.Data;
+    ObjDesc->BufferField.AmlLength = Op->Named.Length;
     ObjDesc->BufferField.Node   = Node;
 
     /* Attach constructed field descriptors to parent node */
diff --git a/source/components/dispatcher/dsopcode.c b/source/components/dispatcher/dsopcode.c
index 3edbacc..352e5bb 100644
--- a/source/components/dispatcher/dsopcode.c
+++ b/source/components/dispatcher/dsopcode.c
@@ -283,7 +283,6 @@ ACPI_STATUS
 AcpiDsGetBufferFieldArguments (
     ACPI_OPERAND_OBJECT     *ObjDesc)
 {
-    ACPI_OPERAND_OBJECT     *ExtraDesc;
     ACPI_NAMESPACE_NODE     *Node;
     ACPI_STATUS             Status;
 
@@ -298,7 +297,6 @@ AcpiDsGetBufferFieldArguments (
 
     /* Get the AML pointer (method object) and BufferField node */
 
-    ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
     Node = ObjDesc->BufferField.Node;
 
     ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, Node, NULL));
@@ -308,7 +306,7 @@ AcpiDsGetBufferFieldArguments (
     /* Execute the AML code for the TermArg arguments */
 
     Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
-                ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+                ObjDesc->BufferField.AmlLength, ObjDesc->BufferField.AmlStart);
     return_ACPI_STATUS (Status);
 }
 
@@ -330,7 +328,6 @@ ACPI_STATUS
 AcpiDsGetBankFieldArguments (
     ACPI_OPERAND_OBJECT     *ObjDesc)
 {
-    ACPI_OPERAND_OBJECT     *ExtraDesc;
     ACPI_NAMESPACE_NODE     *Node;
     ACPI_STATUS             Status;
 
@@ -345,7 +342,6 @@ AcpiDsGetBankFieldArguments (
 
     /* Get the AML pointer (method object) and BankField node */
 
-    ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
     Node = ObjDesc->BankField.Node;
 
     ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL));
@@ -355,7 +351,7 @@ AcpiDsGetBankFieldArguments (
     /* Execute the AML code for the TermArg arguments */
 
     Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
-                ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+                ObjDesc->BankField.AmlLength, ObjDesc->BankField.AmlStart);
     return_ACPI_STATUS (Status);
 }
 
@@ -477,8 +473,6 @@ AcpiDsGetRegionArguments (
 {
     ACPI_NAMESPACE_NODE     *Node;
     ACPI_STATUS             Status;
-    ACPI_OPERAND_OBJECT     *ExtraDesc;
-
 
     ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
 
@@ -488,12 +482,6 @@ AcpiDsGetRegionArguments (
         return_ACPI_STATUS (AE_OK);
     }
 
-    ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
-    if (!ExtraDesc)
-    {
-        return_ACPI_STATUS (AE_NOT_EXIST);
-    }
-
     /* Get the Region node */
 
     Node = ObjDesc->Region.Node;
@@ -501,12 +489,12 @@ AcpiDsGetRegionArguments (
     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL));
 
     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
-        AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
+        AcpiUtGetNodeName (Node), ObjDesc->Region.AmlStart));
 
     /* Execute the argument AML */
 
     Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
-                ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+                ObjDesc->Region.AmlLength, ObjDesc->Region.AmlStart);
     return_ACPI_STATUS (Status);
 }
 
diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c
index 0993f39..ca36784 100644
--- a/source/components/events/evregion.c
+++ b/source/components/events/evregion.c
@@ -298,20 +298,13 @@ AcpiEvExecuteRegMethod (
 {
     ACPI_EVALUATE_INFO      *Info;
     ACPI_OPERAND_OBJECT     *Args[3];
-    ACPI_OPERAND_OBJECT     *RegionObj2;
     ACPI_STATUS             Status;
 
 
     ACPI_FUNCTION_TRACE (EvExecuteRegMethod);
 
 
-    RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
-    if (!RegionObj2)
-    {
-        return_ACPI_STATUS (AE_NOT_EXIST);
-    }
-
-    if (RegionObj2->Extra.Method_REG == NULL)
+    if (RegionObj->Region.Method_REG == NULL)
     {
         return_ACPI_STATUS (AE_OK);
     }
@@ -324,7 +317,7 @@ AcpiEvExecuteRegMethod (
         return_ACPI_STATUS (AE_NO_MEMORY);
     }
 
-    Info->PrefixNode = RegionObj2->Extra.Method_REG;
+    Info->PrefixNode = RegionObj->Region.Method_REG;
     Info->Pathname = NULL;
     Info->Parameters = Args;
     Info->Flags = ACPI_IGNORE_RETURN_VALUE;
@@ -406,19 +399,10 @@ AcpiEvAddressSpaceDispatch (
     ACPI_ADR_SPACE_HANDLER  Handler;
     ACPI_ADR_SPACE_SETUP    RegionSetup;
     ACPI_OPERAND_OBJECT     *HandlerDesc;
-    ACPI_OPERAND_OBJECT     *RegionObj2;
     void                    *RegionContext = NULL;
 
-
     ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch);
 
-
-    RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
-    if (!RegionObj2)
-    {
-        return_ACPI_STATUS (AE_NOT_EXIST);
-    }
-
     /* Ensure that there is a handler associated with this region */
 
     HandlerDesc = RegionObj->Region.Handler;
@@ -481,7 +465,7 @@ AcpiEvAddressSpaceDispatch (
         {
             RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
 
-            if (RegionObj2->Extra.RegionContext)
+            if (RegionObj->Region.RegionContext)
             {
                 /* The handler for this region was already installed */
 
@@ -493,7 +477,7 @@ AcpiEvAddressSpaceDispatch (
                  * Save the returned context for use in all accesses to
                  * this particular region
                  */
-                RegionObj2->Extra.RegionContext = RegionContext;
+                RegionObj->Region.RegionContext = RegionContext;
             }
         }
     }
@@ -522,7 +506,7 @@ AcpiEvAddressSpaceDispatch (
     /* Call the handler */
 
     Status = Handler (Function, Address, BitWidth, Value,
-        HandlerDesc->AddressSpace.Context, RegionObj2->Extra.RegionContext);
+        HandlerDesc->AddressSpace.Context, RegionObj->Region.RegionContext);
 
     if (ACPI_FAILURE (Status))
     {
@@ -568,19 +552,13 @@ AcpiEvDetachRegion(
     ACPI_OPERAND_OBJECT     **LastObjPtr;
     ACPI_ADR_SPACE_SETUP    RegionSetup;
     void                    **RegionContext;
-    ACPI_OPERAND_OBJECT     *RegionObj2;
     ACPI_STATUS             Status;
 
 
     ACPI_FUNCTION_TRACE (EvDetachRegion);
 
 
-    RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
-    if (!RegionObj2)
-    {
-        return_VOID;
-    }
-    RegionContext = &RegionObj2->Extra.RegionContext;
+    RegionContext = &RegionObj->Region.RegionContext;
 
     /* Get the address handler from the region object */
 
@@ -1042,10 +1020,6 @@ AcpiEvInstallSpaceHandler (
             goto UnlockAndExit;
         }
 
-        /* Init new descriptor */
-
-        ObjDesc->Common.Type = (UINT8) Type;
-
         /* Attach the new object to the Node */
 
         Status = AcpiNsAttachObject (Node, ObjDesc, Type);
diff --git a/source/components/events/evrgnini.c b/source/components/events/evrgnini.c
index 187aebe..faa30cb 100644
--- a/source/components/events/evrgnini.c
+++ b/source/components/events/evrgnini.c
@@ -675,8 +675,6 @@ AcpiEvInitializeRegion (
     ACPI_STATUS             Status;
     ACPI_NAMESPACE_NODE     *MethodNode;
     ACPI_NAME               *RegNamePtr = (ACPI_NAME *) METHOD_NAME__REG;
-    ACPI_OPERAND_OBJECT     *RegionObj2;
-
 
     ACPI_FUNCTION_TRACE_U32 (EvInitializeRegion, AcpiNsLocked);
 
@@ -691,19 +689,13 @@ AcpiEvInitializeRegion (
         return_ACPI_STATUS (AE_OK);
     }
 
-    RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
-    if (!RegionObj2)
-    {
-        return_ACPI_STATUS (AE_NOT_EXIST);
-    }
-
     Node = AcpiNsGetParentNode (RegionObj->Region.Node);
     SpaceId = RegionObj->Region.SpaceId;
 
     /* Setup defaults */
 
     RegionObj->Region.Handler = NULL;
-    RegionObj2->Extra.Method_REG = NULL;
+    RegionObj->Region.Method_REG = NULL;
     RegionObj->Common.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
     RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;
 
@@ -718,7 +710,7 @@ AcpiEvInitializeRegion (
          * definition. This will be executed when the handler is attached
          * or removed
          */
-        RegionObj2->Extra.Method_REG = MethodNode;
+        RegionObj->Region.Method_REG = MethodNode;
     }
 
     /*
diff --git a/source/components/executer/excreate.c b/source/components/executer/excreate.c
index 55385a0..cd3ed75 100644
--- a/source/components/executer/excreate.c
+++ b/source/components/executer/excreate.c
@@ -376,8 +376,6 @@ AcpiExCreateRegion (
     ACPI_STATUS             Status;
     ACPI_OPERAND_OBJECT     *ObjDesc;
     ACPI_NAMESPACE_NODE     *Node;
-    ACPI_OPERAND_OBJECT     *RegionObj2;
-
 
     ACPI_FUNCTION_TRACE (ExCreateRegion);
 
@@ -422,9 +420,8 @@ AcpiExCreateRegion (
      * Remember location in AML stream of address & length
      * operands since they need to be evaluated at run time.
      */
-    RegionObj2 = ObjDesc->Common.NextObject;
-    RegionObj2->Extra.AmlStart = AmlStart;
-    RegionObj2->Extra.AmlLength = AmlLength;
+    ObjDesc->Region.AmlStart = AmlStart;
+    ObjDesc->Region.AmlLength = AmlLength;
 
     /* Init the region from the operands */
 
diff --git a/source/components/executer/exprep.c b/source/components/executer/exprep.c
index c915361..67369b6 100644
--- a/source/components/executer/exprep.c
+++ b/source/components/executer/exprep.c
@@ -511,7 +511,6 @@ AcpiExPrepFieldValue (
     ACPI_CREATE_FIELD_INFO  *Info)
 {
     ACPI_OPERAND_OBJECT     *ObjDesc;
-    ACPI_OPERAND_OBJECT     *SecondDesc = NULL;
     UINT32                  Type;
     ACPI_STATUS             Status;
 
@@ -604,9 +603,8 @@ AcpiExPrepFieldValue (
          * opcode and operands -- since the BankValue
          * operands must be evaluated.
          */
-        SecondDesc                  = ObjDesc->Common.NextObject;
-        SecondDesc->Extra.AmlStart  = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Data;
-        SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Length;
+        ObjDesc->BankField.AmlStart  = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Data;
+        ObjDesc->BankField.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Length;
 
         break;
 
diff --git a/source/components/namespace/nsobject.c b/source/components/namespace/nsobject.c
index 53afe60..9191e79 100644
--- a/source/components/namespace/nsobject.c
+++ b/source/components/namespace/nsobject.c
@@ -373,39 +373,6 @@ AcpiNsGetAttachedObject (
     return_PTR (Node->Object);
 }
 
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiNsGetSecondaryObject
- *
- * PARAMETERS:  Node             - Namespace node
- *
- * RETURN:      Current value of the object field from the Node whose
- *              handle is passed.
- *
- * DESCRIPTION: Obtain a secondary object associated with a namespace node.
- *
- ******************************************************************************/
-
-ACPI_OPERAND_OBJECT *
-AcpiNsGetSecondaryObject (
-    ACPI_OPERAND_OBJECT     *ObjDesc)
-{
-    ACPI_FUNCTION_TRACE_PTR (NsGetSecondaryObject, ObjDesc);
-
-
-    if ((!ObjDesc)                                     ||
-        (ObjDesc->Common.Type== ACPI_TYPE_LOCAL_DATA)  ||
-        (!ObjDesc->Common.NextObject)                  ||
-        ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA))
-    {
-        return_PTR (NULL);
-    }
-
-    return_PTR (ObjDesc->Common.NextObject);
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiNsAttachData
diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c
index 20a0e34..785c313 100644
--- a/source/components/utilities/utcopy.c
+++ b/source/components/utilities/utcopy.c
@@ -807,7 +807,7 @@ AcpiUtCopySimpleObject (
     /* Copy the entire source object over the destination object*/
 
     ACPI_MEMCPY ((char *) DestDesc, (char *) SourceDesc,
-                    sizeof (ACPI_OPERAND_OBJECT));
+                    AcpiUtOperandSize(DestDesc->Common.Type));
 
     /* Restore the saved fields */
 
diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c
index 9dd05f6..f37147b 100644
--- a/source/components/utilities/utdelete.c
+++ b/source/components/utilities/utdelete.c
@@ -156,7 +156,6 @@ AcpiUtDeleteInternalObj (
 {
     void                    *ObjPointer = NULL;
     ACPI_OPERAND_OBJECT     *HandlerDesc;
-    ACPI_OPERAND_OBJECT     *SecondDesc;
     ACPI_OPERAND_OBJECT     *NextDesc;
 
 
@@ -306,9 +305,6 @@ AcpiUtDeleteInternalObj (
         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
             "***** Region %p\n", Object));
 
-        SecondDesc = AcpiNsGetSecondaryObject (Object);
-        if (SecondDesc)
-        {
             /*
              * Free the RegionContext if and only if the handler is one of the
              * default handlers -- and therefore, we created the context object
@@ -327,46 +323,14 @@ AcpiUtDeleteInternalObj (
                         (void) HandlerDesc->AddressSpace.Setup (Object,
                             ACPI_REGION_DEACTIVATE,
                             HandlerDesc->AddressSpace.Context,
-                            &SecondDesc->Extra.RegionContext);
+                            &Object->Region.RegionContext);
                     }
                 }
 
                 AcpiUtRemoveReference (HandlerDesc);
             }
-
-            /* Now we can free the Extra object */
-
-            AcpiUtDeleteObjectDesc (SecondDesc);
-        }
         break;
 
-
-    case ACPI_TYPE_BUFFER_FIELD:
-
-        ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-            "***** Buffer Field %p\n", Object));
-
-        SecondDesc = AcpiNsGetSecondaryObject (Object);
-        if (SecondDesc)
-        {
-            AcpiUtDeleteObjectDesc (SecondDesc);
-        }
-        break;
-
-
-    case ACPI_TYPE_LOCAL_BANK_FIELD:
-
-        ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-            "***** Bank Field %p\n", Object));
-
-        SecondDesc = AcpiNsGetSecondaryObject (Object);
-        if (SecondDesc)
-        {
-            AcpiUtDeleteObjectDesc (SecondDesc);
-        }
-        break;
-
-
     default:
         break;
     }
diff --git a/source/components/utilities/utobject.c b/source/components/utilities/utobject.c
index 4d2c64c..e6caba7 100644
--- a/source/components/utilities/utobject.c
+++ b/source/components/utilities/utobject.c
@@ -142,7 +142,7 @@ AcpiUtGetElementLength (
     ACPI_GENERIC_STATE      *State,
     void                    *Context);
 
-
+ACPI_SIZE AcpiUtOperandSize(int Type);
 /*******************************************************************************
  *
  * FUNCTION:    AcpiUtCreateInternalObjectDbg
@@ -155,13 +155,6 @@ AcpiUtGetElementLength (
  * RETURN:      A new internal object, null on failure
  *
  * DESCRIPTION: Create and initialize a new internal object.
- *
- * NOTE:        We always allocate the worst-case object descriptor because
- *              these objects are cached, and we want them to be
- *              one-size-satisifies-any-request.  This in itself may not be
- *              the most memory efficient, but the efficiency of the object
- *              cache should more than make up for this!
- *
  ******************************************************************************/
 
 ACPI_OPERAND_OBJECT  *
@@ -172,50 +165,20 @@ AcpiUtCreateInternalObjectDbg (
     ACPI_OBJECT_TYPE        Type)
 {
     ACPI_OPERAND_OBJECT     *Object;
-    ACPI_OPERAND_OBJECT     *SecondObject;
-
 
     ACPI_FUNCTION_TRACE_STR (UtCreateInternalObjectDbg,
         AcpiUtGetTypeName (Type));
 
 
     /* Allocate the raw object descriptor */
+    Object = ACPI_ALLOCATE_ZEROED(AcpiUtOperandSize(Type));
 
-    Object = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId);
     if (!Object)
     {
         return_PTR (NULL);
     }
 
-    switch (Type)
-    {
-    case ACPI_TYPE_REGION:
-    case ACPI_TYPE_BUFFER_FIELD:
-    case ACPI_TYPE_LOCAL_BANK_FIELD:
-
-        /* These types require a secondary object */
-
-        SecondObject = AcpiUtAllocateObjectDescDbg (ModuleName,
-                            LineNumber, ComponentId);
-        if (!SecondObject)
-        {
-            AcpiUtDeleteObjectDesc (Object);
-            return_PTR (NULL);
-        }
-
-        SecondObject->Common.Type = ACPI_TYPE_LOCAL_EXTRA;
-        SecondObject->Common.ReferenceCount = 1;
-
-        /* Link the second object to the first */
-
-        Object->Common.NextObject = SecondObject;
-        break;
-
-    default:
-        /* All others have no secondary object */
-        break;
-    }
-
+    ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_OPERAND);
     /* Save the object type in the object descriptor */
 
     Object->Common.Type = (UINT8) Type;
@@ -443,54 +406,6 @@ AcpiUtValidInternalObject (
     return (FALSE);
 }
 
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtAllocateObjectDescDbg
- *
- * PARAMETERS:  ModuleName          - Caller's module name (for error output)
- *              LineNumber          - Caller's line number (for error output)
- *              ComponentId         - Caller's component ID (for error output)
- *
- * RETURN:      Pointer to newly allocated object descriptor.  Null on error
- *
- * DESCRIPTION: Allocate a new object descriptor.  Gracefully handle
- *              error conditions.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocateObjectDescDbg (
-    const char              *ModuleName,
-    UINT32                  LineNumber,
-    UINT32                  ComponentId)
-{
-    ACPI_OPERAND_OBJECT     *Object;
-
-
-    ACPI_FUNCTION_TRACE (UtAllocateObjectDescDbg);
-
-
-    Object = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_OPERAND_OBJECT));
-    if (!Object)
-    {
-        ACPI_ERROR ((ModuleName, LineNumber,
-            "Could not allocate an object descriptor"));
-
-        return_PTR (NULL);
-    }
-
-    /* Mark the descriptor type */
-
-    ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_OPERAND);
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
-            Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT)));
-
-    return_PTR (Object);
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiUtDeleteObjectDesc
@@ -525,6 +440,79 @@ AcpiUtDeleteObjectDesc (
 }
 
 
+ACPI_SIZE AcpiUtOperandSize(int Type)
+{
+    ACPI_SIZE ObjSize = 0;
+
+    switch (Type) {
+	case ACPI_TYPE_INTEGER:
+		ObjSize = sizeof (ACPI_OBJECT_INTEGER);
+		break;
+	case ACPI_TYPE_BUFFER_FIELD:
+		ObjSize = sizeof (ACPI_OBJECT_BUFFER_FIELD);
+		break;
+	case ACPI_TYPE_LOCAL_BANK_FIELD:
+		ObjSize = sizeof (ACPI_OBJECT_BANK_FIELD);
+		break;
+	case ACPI_TYPE_LOCAL_INDEX_FIELD:
+		ObjSize = sizeof (ACPI_OBJECT_INDEX_FIELD);
+		break;
+	case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
+		ObjSize = sizeof (ACPI_OBJECT_ADDR_HANDLER);
+		break;
+	case ACPI_TYPE_MUTEX:
+		ObjSize = sizeof (ACPI_OBJECT_MUTEX);
+		break;
+	case ACPI_TYPE_REGION:
+		ObjSize = sizeof (ACPI_OBJECT_REGION);
+		break;
+	case ACPI_TYPE_STRING:
+		ObjSize = sizeof (ACPI_OBJECT_STRING);
+		break;
+	case ACPI_TYPE_BUFFER:
+		ObjSize = sizeof (ACPI_OBJECT_BUFFER);
+		break;
+	case ACPI_TYPE_PACKAGE:
+		ObjSize = sizeof (ACPI_OBJECT_PACKAGE);
+		break;
+	case ACPI_TYPE_EVENT:
+		ObjSize = sizeof (ACPI_OBJECT_EVENT);
+		break;
+	case ACPI_TYPE_METHOD:
+		ObjSize = sizeof (ACPI_OBJECT_METHOD);
+		break;
+	case ACPI_TYPE_DEVICE:
+		ObjSize = sizeof (ACPI_OBJECT_DEVICE);
+		break;
+	case ACPI_TYPE_POWER:
+		ObjSize = sizeof (ACPI_OBJECT_POWER_RESOURCE);
+		break;
+	case ACPI_TYPE_PROCESSOR:
+		ObjSize = sizeof (ACPI_OBJECT_PROCESSOR);
+		break;
+	case ACPI_TYPE_THERMAL:
+		ObjSize = sizeof (ACPI_OBJECT_THERMAL_ZONE);
+		break;
+	case ACPI_TYPE_LOCAL_REGION_FIELD:
+		ObjSize = sizeof (ACPI_OBJECT_REGION_FIELD);
+		break;
+	case ACPI_TYPE_LOCAL_NOTIFY:
+		ObjSize = sizeof (ACPI_OBJECT_NOTIFY_HANDLER);
+		break;
+	case ACPI_TYPE_LOCAL_REFERENCE:
+		ObjSize = sizeof (ACPI_OBJECT_REFERENCE);
+		break;
+	case ACPI_TYPE_LOCAL_DATA:
+		ObjSize = sizeof (ACPI_OBJECT_DATA);
+		break;
+	default:
+		ACPI_ERROR ((AE_INFO,
+		"Unexpected type of object descriptor"));
+		return 0;
+     }
+     return ObjSize;
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    AcpiUtGetSimpleObjectSize
diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h
index 2aa042a..b2a136c 100644
--- a/source/include/acnamesp.h
+++ b/source/include/acnamesp.h
@@ -385,10 +385,6 @@ ACPI_OPERAND_OBJECT *
 AcpiNsGetAttachedObject (
     ACPI_NAMESPACE_NODE     *Node);
 
-ACPI_OPERAND_OBJECT *
-AcpiNsGetSecondaryObject (
-    ACPI_OPERAND_OBJECT     *ObjDesc);
-
 ACPI_STATUS
 AcpiNsAttachData (
     ACPI_NAMESPACE_NODE     *Node,
diff --git a/source/include/acobject.h b/source/include/acobject.h
index a82e07d..c78696b 100644
--- a/source/include/acobject.h
+++ b/source/include/acobject.h
@@ -275,6 +275,10 @@ typedef struct acpi_object_region
     union acpi_operand_object       *Next;
     ACPI_PHYSICAL_ADDRESS           Address;
     UINT32                          Length;
+    ACPI_NAMESPACE_NODE             *Method_REG;        /* _REG method for this region (if any) */
+    void                            *RegionContext;     /* Region-specific data */
+    UINT8                           *AmlStart;
+    UINT32                          AmlLength;
 
 } ACPI_OBJECT_REGION;
 
@@ -406,6 +410,8 @@ typedef struct acpi_object_bank_field
     ACPI_COMMON_FIELD_INFO
     union acpi_operand_object       *RegionObj;         /* Containing OpRegion object */
     union acpi_operand_object       *BankObj;           /* BankSelect Register object */
+    UINT8                           *AmlStart;
+    UINT32                          AmlLength;
 
 } ACPI_OBJECT_BANK_FIELD;
 
@@ -432,6 +438,8 @@ typedef struct acpi_object_buffer_field
     ACPI_OBJECT_COMMON_HEADER
     ACPI_COMMON_FIELD_INFO
     union acpi_operand_object       *BufferObj;         /* Containing Buffer object */
+    UINT8                           *AmlStart;
+    UINT32                          AmlLength;
 
 } ACPI_OBJECT_BUFFER_FIELD;
 
@@ -511,25 +519,6 @@ typedef enum
 
 } ACPI_REFERENCE_CLASSES;
 
-
-/*
- * Extra object is used as additional storage for types that
- * have AML code in their declarations (TermArgs) that must be
- * evaluated at run time.
- *
- * Currently: Region and FieldUnit types
- */
-typedef struct acpi_object_extra
-{
-    ACPI_OBJECT_COMMON_HEADER
-    ACPI_NAMESPACE_NODE             *Method_REG;        /* _REG method for this region (if any) */
-    void                            *RegionContext;     /* Region-specific data */
-    UINT8                           *AmlStart;
-    UINT32                          AmlLength;
-
-} ACPI_OBJECT_EXTRA;
-
-
 /* Additional data that can be attached to namespace nodes */
 
 typedef struct acpi_object_data
@@ -570,7 +559,6 @@ typedef union acpi_operand_object
     ACPI_OBJECT_NOTIFY_HANDLER          Notify;
     ACPI_OBJECT_ADDR_HANDLER            AddressSpace;
     ACPI_OBJECT_REFERENCE               Reference;
-    ACPI_OBJECT_EXTRA                   Extra;
     ACPI_OBJECT_DATA                    Data;
 
     /*
@@ -582,7 +570,6 @@ typedef union acpi_operand_object
 
 } ACPI_OPERAND_OBJECT;
 
-
 /******************************************************************************
  *
  * ACPI_DESCRIPTOR - objects that share a common descriptor identifier
diff --git a/source/include/actypes.h b/source/include/actypes.h
index 9885f8a..51111ff 100644
--- a/source/include/actypes.h
+++ b/source/include/actypes.h
@@ -669,7 +669,6 @@ typedef UINT32                          ACPI_OBJECT_TYPE;
  * These are special object types that never appear in
  * a Namespace node, only in an ACPI_OPERAND_OBJECT
  */
-#define ACPI_TYPE_LOCAL_EXTRA           0x1C
 #define ACPI_TYPE_LOCAL_DATA            0x1D
 
 #define ACPI_TYPE_LOCAL_MAX             0x1D
diff --git a/source/include/acutils.h b/source/include/acutils.h
index 5573754..b66d3d1 100644
--- a/source/include/acutils.h
+++ b/source/include/acutils.h
@@ -397,7 +397,7 @@ AcpiUtCopyIobjectToIobject (
     ACPI_OPERAND_OBJECT     **DestDesc,
     ACPI_WALK_STATE         *WalkState);
 
-
+ACPI_SIZE AcpiUtOperandSize(int Type);
 /*
  * utcreate - Object creation
  */
diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c
index b430e83..cd9c5d5 100644
--- a/source/os_specific/service_layers/osunixxf.c
+++ b/source/os_specific/service_layers/osunixxf.c
@@ -575,6 +575,8 @@ AcpiOsDeleteSemaphore (
         return (AE_BAD_PARAMETER);
     }
 
+    AcpiOsFree(Sem);
+
     return (AE_OK);
 }
 


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] ACPICA: Delete NextObject pointer
  2009-05-07 15:52 [PATCH 1/4] ACPICA: Remove use of caches in controlled way Alexey Starikovskiy
  2009-05-07 15:52 ` [PATCH 2/4] ACPICA: Remove cache code Alexey Starikovskiy
  2009-05-07 15:52 ` [PATCH 3/4] ACPICA: Drop Operand cache Alexey Starikovskiy
@ 2009-05-07 15:52 ` Alexey Starikovskiy
  2009-05-11  8:14 ` [PATCH 1/4] ACPICA: Remove use of caches in controlled way Lin Ming
  3 siblings, 0 replies; 8+ messages in thread
From: Alexey Starikovskiy @ 2009-05-07 15:52 UTC (permalink / raw)
  To: Moore, Robert; +Cc: Linux-acpi

NextObject field was used for double objects (removed by prev patch) and
for data objects. Data object size is now untangled from all other object
sizes, so we can save size of pointer in all object allocations.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

 source/components/namespace/nsobject.c |   38 ++++++--------------------------
 source/components/utilities/utcopy.c   |   13 ++++++++---
 source/include/aclocal.h               |    4 ++-
 source/include/acobject.h              |    3 +--
 4 files changed, 19 insertions(+), 39 deletions(-)


diff --git a/source/components/namespace/nsobject.c b/source/components/namespace/nsobject.c
index 9191e79..10e1b4d 100644
--- a/source/components/namespace/nsobject.c
+++ b/source/components/namespace/nsobject.c
@@ -154,7 +154,6 @@ AcpiNsAttachObject (
     ACPI_OBJECT_TYPE        Type)
 {
     ACPI_OPERAND_OBJECT     *ObjDesc;
-    ACPI_OPERAND_OBJECT     *LastObjDesc;
     ACPI_OBJECT_TYPE        ObjectType = ACPI_TYPE_ANY;
 
 
@@ -255,19 +254,6 @@ AcpiNsAttachObject (
          */
         AcpiUtAddReference (ObjDesc);
 
-        /*
-         * Handle objects with multiple descriptors - walk
-         * to the end of the descriptor list
-         */
-        LastObjDesc = ObjDesc;
-        while (LastObjDesc->Common.NextObject)
-        {
-            LastObjDesc = LastObjDesc->Common.NextObject;
-        }
-
-        /* Install the object at the front of the object list */
-
-        LastObjDesc->Common.NextObject = Node->Object;
     }
 
     Node->Type     = (UINT8) ObjectType;
@@ -312,15 +298,6 @@ AcpiNsDetachObject (
     /* Clear the entry in all cases */
 
     Node->Object = NULL;
-    if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
-    {
-        Node->Object = ObjDesc->Common.NextObject;
-        if (Node->Object &&
-           ((Node->Object)->Common.Type != ACPI_TYPE_LOCAL_DATA))
-        {
-            Node->Object = Node->Object->Common.NextObject;
-        }
-    }
 
     /* Reset the node type to untyped */
 
@@ -404,14 +381,13 @@ AcpiNsAttachData (
     ObjDesc = Node->Object;
     while (ObjDesc)
     {
-        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
-            (ObjDesc->Data.Handler == Handler))
+        if (ObjDesc->Data.Handler == Handler)
         {
             return (AE_ALREADY_EXISTS);
         }
 
         PrevObjDesc = ObjDesc;
-        ObjDesc = ObjDesc->Common.NextObject;
+        ObjDesc = ObjDesc->Data.Next;
     }
 
     /* Create an internal object for the data */
@@ -429,7 +405,7 @@ AcpiNsAttachData (
 
     if (PrevObjDesc)
     {
-        PrevObjDesc->Common.NextObject = DataDesc;
+        PrevObjDesc->Data.Next = DataDesc;
     }
     else
     {
@@ -472,11 +448,11 @@ AcpiNsDetachData (
         {
             if (PrevObjDesc)
             {
-                PrevObjDesc->Common.NextObject = ObjDesc->Common.NextObject;
+                PrevObjDesc->Data.Next = ObjDesc->Data.Next;
             }
             else
             {
-                Node->Object = ObjDesc->Common.NextObject;
+                Node->Object = ObjDesc->Data.Next;
             }
 
             AcpiUtRemoveReference (ObjDesc);
@@ -484,7 +460,7 @@ AcpiNsDetachData (
         }
 
         PrevObjDesc = ObjDesc;
-        ObjDesc = ObjDesc->Common.NextObject;
+        ObjDesc = ObjDesc->Data.Next;
     }
 
     return (AE_NOT_FOUND);
@@ -525,7 +501,7 @@ AcpiNsGetAttachedData (
             return (AE_OK);
         }
 
-        ObjDesc = ObjDesc->Common.NextObject;
+        ObjDesc = ObjDesc->Data.Next;
     }
 
     return (AE_NOT_FOUND);
diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c
index 785c313..192db88 100644
--- a/source/components/utilities/utcopy.c
+++ b/source/components/utilities/utcopy.c
@@ -795,14 +795,17 @@ AcpiUtCopySimpleObject (
     ACPI_OPERAND_OBJECT     *DestDesc)
 {
     UINT16                  ReferenceCount;
-    ACPI_OPERAND_OBJECT     *NextObject;
+    ACPI_OPERAND_OBJECT     *NextObject = NULL;
     ACPI_STATUS             Status;
 
 
     /* Save fields from destination that we don't want to overwrite */
 
     ReferenceCount = DestDesc->Common.ReferenceCount;
-    NextObject = DestDesc->Common.NextObject;
+    if (DestDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)
+    {
+	NextObject = DestDesc->Data.Next;
+    }
 
     /* Copy the entire source object over the destination object*/
 
@@ -812,8 +815,10 @@ AcpiUtCopySimpleObject (
     /* Restore the saved fields */
 
     DestDesc->Common.ReferenceCount = ReferenceCount;
-    DestDesc->Common.NextObject = NextObject;
-
+    if (DestDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)
+    {
+	DestDesc->Data.Next = NextObject;
+    }
     /* New object is not static, regardless of source */
 
     DestDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
diff --git a/source/include/aclocal.h b/source/include/aclocal.h
index 4598d28..eade51f 100644
--- a/source/include/aclocal.h
+++ b/source/include/aclocal.h
@@ -269,7 +269,6 @@ typedef enum
  */
 typedef struct acpi_namespace_node
 {
-    union acpi_operand_object       *Object;        /* Interpreter object */
     UINT8                           DescriptorType; /* Differentiate object descriptor types */
     UINT8                           Type;           /* ACPI Type associated with this name */
     UINT8                           Flags;          /* Miscellaneous flags */
@@ -277,6 +276,7 @@ typedef struct acpi_namespace_node
     ACPI_NAME_UNION                 Name;           /* ACPI Name, always 4 chars per ACPI spec */
     struct acpi_namespace_node      *Child;         /* First child */
     struct acpi_namespace_node      *Peer;          /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
+    union acpi_operand_object       *Object;        /* Interpreter object */
 
     /*
      * The following fields are used by the ASL compiler and disassembler only
@@ -852,11 +852,11 @@ typedef union acpi_parse_value
 #endif
 
 #define ACPI_PARSE_COMMON \
-    union acpi_parse_object         *Parent;        /* Parent op */\
     UINT8                           DescriptorType; /* To differentiate various internal objs */\
     UINT8                           Flags;          /* Type of Op */\
     UINT16                          AmlOpcode;      /* AML opcode */\
     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
+    union acpi_parse_object         *Parent;        /* Parent op */\
     union acpi_parse_object         *Next;          /* Next op */\
     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
diff --git a/source/include/acobject.h b/source/include/acobject.h
index c78696b..29caa8d 100644
--- a/source/include/acobject.h
+++ b/source/include/acobject.h
@@ -152,7 +152,6 @@
  * structures.
  */
 #define ACPI_OBJECT_COMMON_HEADER \
-    union acpi_operand_object       *NextObject;        /* Objects linked to parent NS node */\
     UINT8                           DescriptorType;     /* To differentiate various internal objs */\
     UINT8                           Type;               /* ACPI_OBJECT_TYPE */\
     UINT16                          ReferenceCount;     /* For object deletion management */\
@@ -524,6 +523,7 @@ typedef enum
 typedef struct acpi_object_data
 {
     ACPI_OBJECT_COMMON_HEADER
+    union acpi_operand_object       *Next;        /* Objects linked to parent NS node */
     ACPI_OBJECT_HANDLER             Handler;
     void                            *Pointer;
 
@@ -598,7 +598,6 @@ typedef union acpi_operand_object
 
 typedef struct acpi_common_descriptor
 {
-    void                            *CommonPointer;
     UINT8                           DescriptorType; /* To differentiate various internal objs */
 
 } ACPI_COMMON_DESCRIPTOR;


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled way
  2009-05-07 15:52 [PATCH 1/4] ACPICA: Remove use of caches in controlled way Alexey Starikovskiy
                   ` (2 preceding siblings ...)
  2009-05-07 15:52 ` [PATCH 4/4] ACPICA: Delete NextObject pointer Alexey Starikovskiy
@ 2009-05-11  8:14 ` Lin Ming
  2009-05-11 15:42   ` Moore, Robert
  3 siblings, 1 reply; 8+ messages in thread
From: Lin Ming @ 2009-05-11  8:14 UTC (permalink / raw)
  To: Alexey Starikovskiy; +Cc: Moore, Robert, Linux-acpi@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 4842 bytes --]

Hi, Alexey

The attachment are the linuxized version of your patches.
I added another patch (the 4th) to remove linux specific cache code.

The patches are applied on top of linux-acpi-2.6/acpica branch.

Do you have any suggestion what data I should collect to verify if these
patches have a performance gain?

Lin Ming

On Thu, 2009-05-07 at 23:52 +0800, Alexey Starikovskiy wrote:
> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
> ---
> 
>  source/components/utilities/utcache.c |   99 +++++----------------------------
>  1 files changed, 14 insertions(+), 85 deletions(-)
> 
> 
> diff --git a/source/components/utilities/utcache.c b/source/components/utilities/utcache.c
> index aabc0a2..d08d520 100644
> --- a/source/components/utilities/utcache.c
> +++ b/source/components/utilities/utcache.c
> @@ -287,49 +287,15 @@ AcpiOsReleaseObject (
>      ACPI_MEMORY_LIST        *Cache,
>      void                    *Object)
>  {
> -    ACPI_STATUS             Status;
> -
> -
>      ACPI_FUNCTION_ENTRY ();
>  
> -
>      if (!Cache || !Object)
>      {
>          return (AE_BAD_PARAMETER);
>      }
>  
> -    /* 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 */
> -
> -    else
> -    {
> -        Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
> -        if (ACPI_FAILURE (Status))
> -        {
> -            return (Status);
> -        }
> -
> -        /* Mark the object as cached */
> -
> -        ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
> -        ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
> -
> -        /* Put the object at the head of the cache list */
> -
> -        * (ACPI_CAST_INDIRECT_PTR (char,
> -            &(((char *) Object)[Cache->LinkOffset]))) = Cache->ListHead;
> -        Cache->ListHead = Object;
> -        Cache->CurrentDepth++;
> -
> -        (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
> -    }
> +    ACPI_FREE (Object);
> +    ACPI_MEM_TRACKING (Cache->TotalFreed++);
>  
>      return (AE_OK);
>  }
> @@ -353,8 +319,6 @@ AcpiOsAcquireObject (
>      ACPI_MEMORY_LIST        *Cache)
>  {
>      ACPI_STATUS             Status;
> -    void                    *Object;
> -
>  
>      ACPI_FUNCTION_NAME (OsAcquireObject);
>  
> @@ -372,61 +336,26 @@ AcpiOsAcquireObject (
>  
>      ACPI_MEM_TRACKING (Cache->Requests++);
>  
> -    /* Check the cache first */
> +    /* The cache is empty, create a new object */
>  
> -    if (Cache->ListHead)
> -    {
> -        /* There is an object available, use it */
> -
> -        Object = Cache->ListHead;
> -        Cache->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
> -                                &(((char *) Object)[Cache->LinkOffset])));
> -
> -        Cache->CurrentDepth--;
> -
> -        ACPI_MEM_TRACKING (Cache->Hits++);
> -        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
> -            "Object %p from %s cache\n", Object, Cache->ListName));
> -
> -        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
> -        if (ACPI_FAILURE (Status))
> -        {
> -            return (NULL);
> -        }
> -
> -        /* Clear (zero) the previously used Object */
> -
> -        ACPI_MEMSET (Object, 0, Cache->ObjectSize);
> -    }
> -    else
> -    {
> -        /* The cache is empty, create a new object */
> -
> -        ACPI_MEM_TRACKING (Cache->TotalAllocated++);
> +    ACPI_MEM_TRACKING (Cache->TotalAllocated++);
>  
>  #ifdef ACPI_DBG_TRACK_ALLOCATIONS
> -        if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache->MaxOccupied)
> -        {
> -            Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed;
> -        }
> +    if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache->MaxOccupied)
> +    {
> +        Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed;
> +    }
>  #endif
>  
> -        /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
> +    /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
>  
> -        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
> -        if (ACPI_FAILURE (Status))
> -        {
> -            return (NULL);
> -        }
> -
> -        Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
> -        if (!Object)
> -        {
> -            return (NULL);
> -        }
> +    Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
> +    if (ACPI_FAILURE (Status))
> +    {
> +        return (NULL);
>      }
>  
> -    return (Object);
> +    return ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
>  }
>  #endif /* ACPI_USE_LOCAL_CACHE */
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: [PATCH_1_4]_ACPICA:_Remove_cache_code --]
[-- Type: text/plain, Size: 13001 bytes --]

    ACPICA: Remove cache code
    
    Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---
 drivers/acpi/acpica/acconfig.h  |    8 -----
 drivers/acpi/acpica/acglobal.h  |    8 -----
 drivers/acpi/acpica/acobject.h  |    7 ----
 drivers/acpi/acpica/nsalloc.c   |    7 ++--
 drivers/acpi/acpica/psutils.c   |    8 ++--
 drivers/acpi/acpica/utalloc.c   |   66 +--------------------------------------
 drivers/acpi/acpica/utobject.c  |    4 +-
 drivers/acpi/acpica/utstate.c   |    4 +-
 drivers/acpi/acpica/utxface.c   |   30 -----------------
 include/acpi/acpiosxf.h         |   16 ---------
 include/acpi/actypes.h          |   10 ------
 include/acpi/platform/acenv.h   |    9 -----
 include/acpi/platform/aclinux.h |    1 -
 13 files changed, 12 insertions(+), 166 deletions(-)

diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h
index e6777fb..aff01be 100644
--- a/drivers/acpi/acpica/acconfig.h
+++ b/drivers/acpi/acpica/acconfig.h
@@ -71,14 +71,6 @@
  */
 #define ACPI_OS_NAME                    "Microsoft Windows NT"
 
-/* Maximum objects in the various object caches */
-
-#define ACPI_MAX_STATE_CACHE_DEPTH      96	/* State objects */
-#define ACPI_MAX_PARSE_CACHE_DEPTH      96	/* Parse tree objects */
-#define ACPI_MAX_EXTPARSE_CACHE_DEPTH   96	/* Parse tree objects */
-#define ACPI_MAX_OBJECT_CACHE_DEPTH     96	/* Interpreter operand objects */
-#define ACPI_MAX_NAMESPACE_CACHE_DEPTH  96	/* Namespace objects */
-
 /*
  * Should the subsystem abort the loading of an ACPI table if the
  * table checksum is incorrect?
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 3d87362..c36e1dc 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -216,14 +216,6 @@ ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
 ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
 #endif
 
-/* Object caches */
-
-ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
-ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
-ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
-ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
-ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
-
 /* Global handlers */
 
 ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index 544dcf8..a8e1319 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -356,12 +356,6 @@ struct acpi_object_data {
 	void *pointer;
 };
 
-/* Structure used when objects are cached for reuse */
-
-struct acpi_object_cache_list {
-	ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next;	/* Link for object cache and internal lists */
-};
-
 /******************************************************************************
  *
  * union acpi_operand_object Descriptor - a giant union of all of the above
@@ -393,7 +387,6 @@ union acpi_operand_object {
 	struct acpi_object_reference reference;
 	struct acpi_object_extra extra;
 	struct acpi_object_data data;
-	struct acpi_object_cache_list cache;
 
 	/*
 	 * Add namespace node to union in order to simplify code that accepts both
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index aceb931..f3d06aa 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -68,7 +68,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
 
 	ACPI_FUNCTION_TRACE(ns_create_node);
 
-	node = acpi_os_acquire_object(acpi_gbl_namespace_cache);
+	node = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_namespace_node));
 	if (!node) {
 		return_PTR(NULL);
 	}
@@ -147,7 +147,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
 	/* Detach an object if there is one, then delete the node */
 
 	acpi_ns_detach_object(node);
-	(void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
+	ACPI_FREE(node);
 	return_VOID;
 }
 
@@ -287,8 +287,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
 
 		/* Now we can delete the node */
 
-		(void)acpi_os_release_object(acpi_gbl_namespace_cache,
-					     child_node);
+		ACPI_FREE(child_node);
 
 		/* And move on to the next child in the list */
 
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index e636e07..913c585 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -139,11 +139,11 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
 
 		/* The generic op (default) is by far the most common (16 to 1) */
 
-		op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
+		op = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_parse_obj_common));
 	} else {
 		/* Extended parseop */
 
-		op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache);
+		op = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_parse_obj_named));
 	}
 
 	/* Initialize the Op */
@@ -179,9 +179,9 @@ void acpi_ps_free_op(union acpi_parse_object *op)
 	}
 
 	if (op->common.flags & ACPI_PARSEOP_GENERIC) {
-		(void)acpi_os_release_object(acpi_gbl_ps_node_cache, op);
+		ACPI_FREE(op);
 	} else {
-		(void)acpi_os_release_object(acpi_gbl_ps_node_ext_cache, op);
+		ACPI_FREE(op);
 	}
 }
 
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c
index 7580f6b..c1c7594 100644
--- a/drivers/acpi/acpica/utalloc.c
+++ b/drivers/acpi/acpica/utalloc.c
@@ -61,54 +61,8 @@ ACPI_MODULE_NAME("utalloc")
  ******************************************************************************/
 acpi_status acpi_ut_create_caches(void)
 {
-	acpi_status status;
-
-	/* Object Caches, for frequently used objects */
-
-	status =
-	    acpi_os_create_cache("Acpi-Namespace",
-				 sizeof(struct acpi_namespace_node),
-				 ACPI_MAX_NAMESPACE_CACHE_DEPTH,
-				 &acpi_gbl_namespace_cache);
-	if (ACPI_FAILURE(status)) {
-		return (status);
-	}
-
-	status =
-	    acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state),
-				 ACPI_MAX_STATE_CACHE_DEPTH,
-				 &acpi_gbl_state_cache);
-	if (ACPI_FAILURE(status)) {
-		return (status);
-	}
-
-	status =
-	    acpi_os_create_cache("Acpi-Parse",
-				 sizeof(struct acpi_parse_obj_common),
-				 ACPI_MAX_PARSE_CACHE_DEPTH,
-				 &acpi_gbl_ps_node_cache);
-	if (ACPI_FAILURE(status)) {
-		return (status);
-	}
-
-	status =
-	    acpi_os_create_cache("Acpi-ParseExt",
-				 sizeof(struct acpi_parse_obj_named),
-				 ACPI_MAX_EXTPARSE_CACHE_DEPTH,
-				 &acpi_gbl_ps_node_ext_cache);
-	if (ACPI_FAILURE(status)) {
-		return (status);
-	}
-
-	status =
-	    acpi_os_create_cache("Acpi-Operand",
-				 sizeof(union acpi_operand_object),
-				 ACPI_MAX_OBJECT_CACHE_DEPTH,
-				 &acpi_gbl_operand_cache);
-	if (ACPI_FAILURE(status)) {
-		return (status);
-	}
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
+	acpi_status status;
 
 	/* Memory allocation lists */
 
@@ -150,24 +104,6 @@ acpi_status acpi_ut_delete_caches(void)
 		ACPI_STRCPY(buffer, "MEMORY");
 		(void)acpi_db_display_statistics(buffer);
 	}
-#endif
-
-	(void)acpi_os_delete_cache(acpi_gbl_namespace_cache);
-	acpi_gbl_namespace_cache = NULL;
-
-	(void)acpi_os_delete_cache(acpi_gbl_state_cache);
-	acpi_gbl_state_cache = NULL;
-
-	(void)acpi_os_delete_cache(acpi_gbl_operand_cache);
-	acpi_gbl_operand_cache = NULL;
-
-	(void)acpi_os_delete_cache(acpi_gbl_ps_node_cache);
-	acpi_gbl_ps_node_cache = NULL;
-
-	(void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache);
-	acpi_gbl_ps_node_ext_cache = NULL;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
 	/* Debug only - display leftover memory allocation, if any */
 
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index 0207b62..294d905 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -355,7 +355,7 @@ void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
 
 	ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg);
 
-	object = acpi_os_acquire_object(acpi_gbl_operand_cache);
+	object = ACPI_ALLOCATE_ZEROED(sizeof(union acpi_operand_object));
 	if (!object) {
 		ACPI_ERROR((module_name, line_number,
 			    "Could not allocate an object descriptor"));
@@ -399,7 +399,7 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
 		return_VOID;
 	}
 
-	(void)acpi_os_release_object(acpi_gbl_operand_cache, object);
+	ACPI_FREE(object);
 	return_VOID;
 }
 
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c
index 0440c95..ab6fbd4 100644
--- a/drivers/acpi/acpica/utstate.c
+++ b/drivers/acpi/acpica/utstate.c
@@ -158,7 +158,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void)
 
 	ACPI_FUNCTION_ENTRY();
 
-	state = acpi_os_acquire_object(acpi_gbl_state_cache);
+	state = ACPI_ALLOCATE_ZEROED(sizeof(union acpi_generic_state));
 	if (state) {
 
 		/* Initialize */
@@ -341,7 +341,7 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state)
 	/* Ignore null state */
 
 	if (state) {
-		(void)acpi_os_release_object(acpi_gbl_state_cache, state);
+		ACPI_FREE(state);
 	}
 	return_VOID;
 }
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 078a227..e239dea 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -296,13 +296,6 @@ acpi_status acpi_initialize_objects(u32 flags)
 			return (status);
 	}
 
-	/*
-	 * Empty the caches (delete the cached objects) on the assumption that
-	 * the table load filled them up more than they will be at runtime --
-	 * thus wasting non-paged memory.
-	 */
-	status = acpi_purge_cached_objects();
-
 	acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
 	return_ACPI_STATUS(status);
 }
@@ -486,27 +479,4 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
 
 ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
 #endif				/*  ACPI_FUTURE_USAGE  */
-/*****************************************************************************
- *
- * FUNCTION:    acpi_purge_cached_objects
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Empty all caches (delete the cached objects)
- *
- ****************************************************************************/
-acpi_status acpi_purge_cached_objects(void)
-{
-	ACPI_FUNCTION_TRACE(acpi_purge_cached_objects);
-
-	(void)acpi_os_purge_cache(acpi_gbl_state_cache);
-	(void)acpi_os_purge_cache(acpi_gbl_operand_cache);
-	(void)acpi_os_purge_cache(acpi_gbl_ps_node_cache);
-	(void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
-	return_ACPI_STATUS(AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects)
 #endif
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 3e79859..f24c2fb 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -153,22 +153,6 @@ acpi_os_get_physical_address(void *logical_address,
 #endif
 
 /*
- * Memory/Object Cache
- */
-acpi_status
-acpi_os_create_cache(char *cache_name,
-		     u16 object_size,
-		     u16 max_depth, acpi_cache_t ** return_cache);
-
-acpi_status acpi_os_delete_cache(acpi_cache_t * cache);
-
-acpi_status acpi_os_purge_cache(acpi_cache_t * cache);
-
-void *acpi_os_acquire_object(acpi_cache_t * cache);
-
-acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object);
-
-/*
  * Interrupt handlers
  */
 acpi_status
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 37ba576..21abd7a 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -223,16 +223,6 @@ typedef u32 acpi_physical_address;
 #define acpi_cpu_flags			acpi_size
 #endif
 
-/* Object returned from acpi_os_create_cache */
-
-#ifndef acpi_cache_t
-#ifdef ACPI_USE_LOCAL_CACHE
-#define acpi_cache_t                    struct acpi_memory_list
-#else
-#define acpi_cache_t                    void *
-#endif
-#endif
-
 /*
  * Synchronization objects - Mutexes, Semaphores, and spin_locks
  */
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index e62f10d..d6815c0 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -60,14 +60,6 @@
  *
  *****************************************************************************/
 
-#ifdef ACPI_LIBRARY
-/*
- * Note: The non-debug version of the acpi_library does not contain any
- * debug support, for minimal size. The debug version uses ACPI_FULL_DEBUG
- */
-#define ACPI_USE_LOCAL_CACHE
-#endif
-
 #ifdef ACPI_ASL_COMPILER
 #define ACPI_DEBUG_OUTPUT
 #define ACPI_APPLICATION
@@ -89,7 +81,6 @@
 
 #ifdef ACPI_APPLICATION
 #define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_USE_LOCAL_CACHE
 #endif
 
 #ifdef ACPI_FULL_DEBUG
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index fcb8e4b..43bacf2 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -72,7 +72,6 @@
 #define ACPI_EXPORT_SYMBOL(symbol)  EXPORT_SYMBOL(symbol);
 #define strtoul                     simple_strtoul
 
-#define acpi_cache_t                        struct kmem_cache
 #define acpi_spinlock                       spinlock_t *
 #define acpi_cpu_flags                      unsigned long
 #define acpi_thread_id                      struct task_struct *

[-- Attachment #3: [PATCH_2_4]_ACPICA:_Drop_Operand_cache --]
[-- Type: text/plain, Size: 26854 bytes --]

    ACPICA: Drop Operand cache
    
    Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---
 drivers/acpi/acpica/acnamesp.h |    4 -
 drivers/acpi/acpica/acobject.h |   23 ++----
 drivers/acpi/acpica/acutils.h  |    1 +
 drivers/acpi/acpica/dsfield.c  |    6 +-
 drivers/acpi/acpica/dsopcode.c |   24 ++-----
 drivers/acpi/acpica/evregion.c |   33 ++-------
 drivers/acpi/acpica/evrgnini.c |   10 +--
 drivers/acpi/acpica/excreate.c |    6 +-
 drivers/acpi/acpica/exprep.c   |    6 +-
 drivers/acpi/acpica/nsobject.c |   30 --------
 drivers/acpi/acpica/utcopy.c   |    2 +-
 drivers/acpi/acpica/utdelete.c |   74 ++++++--------------
 drivers/acpi/acpica/utobject.c |  156 +++++++++++++++++++--------------------
 include/acpi/actypes.h         |    1 -
 14 files changed, 128 insertions(+), 248 deletions(-)

diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 46cb5b4..70d7d64 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -234,10 +234,6 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct
 						       acpi_namespace_node
 						       *node);
 
-union acpi_operand_object *acpi_ns_get_secondary_object(union
-							acpi_operand_object
-							*obj_desc);
-
 acpi_status
 acpi_ns_attach_data(struct acpi_namespace_node *node,
 		    acpi_object_handler handler, void *data);
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index a8e1319..fdafe1a 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -170,6 +170,10 @@ struct acpi_object_region {
 	union acpi_operand_object *next;
 	acpi_physical_address address;
 	u32 length;
+	struct acpi_namespace_node *method_REG;	/* _REG method for this region (if any) */
+	void *region_context;	/* Region-specific data */
+	u8 *aml_start;
+	u32 aml_length;
 };
 
 struct acpi_object_method {
@@ -255,6 +259,8 @@ struct acpi_object_region_field {
 struct acpi_object_bank_field {
 	ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj;	/* Containing op_region object */
 	union acpi_operand_object *bank_obj;	/* bank_select Register object */
+	u8 *aml_start;
+	u32 aml_length;
 };
 
 struct acpi_object_index_field {
@@ -271,6 +277,8 @@ struct acpi_object_index_field {
 
 struct acpi_object_buffer_field {
 	ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj;	/* Containing Buffer object */
+	u8 *aml_start;
+	u32 aml_length;
 };
 
 /******************************************************************************
@@ -335,20 +343,6 @@ typedef enum {
 	ACPI_REFCLASS_MAX = 6
 } ACPI_REFERENCE_CLASSES;
 
-/*
- * Extra object is used as additional storage for types that
- * have AML code in their declarations (term_args) that must be
- * evaluated at run time.
- *
- * Currently: Region and field_unit types
- */
-struct acpi_object_extra {
-	ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG;	/* _REG method for this region (if any) */
-	void *region_context;	/* Region-specific data */
-	u8 *aml_start;
-	u32 aml_length;
-};
-
 /* Additional data that can be attached to namespace nodes */
 
 struct acpi_object_data {
@@ -385,7 +379,6 @@ union acpi_operand_object {
 	struct acpi_object_notify_handler notify;
 	struct acpi_object_addr_handler address_space;
 	struct acpi_object_reference reference;
-	struct acpi_object_extra extra;
 	struct acpi_object_data data;
 
 	/*
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 897810b..66e9f1e 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -232,6 +232,7 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
 				union acpi_operand_object **dest_desc,
 				struct acpi_walk_state *walk_state);
 
+acpi_size acpi_ut_operand_size(int type);
 /*
  * utcreate - Object creation
  */
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 53e27bc..5d4813f 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -85,7 +85,6 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
 	struct acpi_namespace_node *node;
 	acpi_status status;
 	union acpi_operand_object *obj_desc;
-	union acpi_operand_object *second_desc = NULL;
 	u32 flags;
 
 	ACPI_FUNCTION_TRACE(ds_create_buffer_field);
@@ -176,9 +175,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
 	 * Remember location in AML stream of the field unit opcode and operands --
 	 * since the buffer and index operands must be evaluated.
 	 */
-	second_desc = obj_desc->common.next_object;
-	second_desc->extra.aml_start = op->named.data;
-	second_desc->extra.aml_length = op->named.length;
+	obj_desc->buffer_field.aml_start = op->named.data;
+	obj_desc->buffer_field.aml_length = op->named.length;
 	obj_desc->buffer_field.node = node;
 
 	/* Attach constructed field descriptors to parent node */
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index 584d766..726eae7 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -191,7 +191,6 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node,
 acpi_status
 acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
 {
-	union acpi_operand_object *extra_desc;
 	struct acpi_namespace_node *node;
 	acpi_status status;
 
@@ -203,7 +202,6 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
 
 	/* Get the AML pointer (method object) and buffer_field node */
 
-	extra_desc = acpi_ns_get_secondary_object(obj_desc);
 	node = obj_desc->buffer_field.node;
 
 	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
@@ -214,8 +212,8 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
 	/* Execute the AML code for the term_arg arguments */
 
 	status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
-					   extra_desc->extra.aml_length,
-					   extra_desc->extra.aml_start);
+					   obj_desc->buffer_field.aml_length,
+					   obj_desc->buffer_field.aml_start);
 	return_ACPI_STATUS(status);
 }
 
@@ -235,7 +233,6 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
 acpi_status
 acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc)
 {
-	union acpi_operand_object *extra_desc;
 	struct acpi_namespace_node *node;
 	acpi_status status;
 
@@ -247,7 +244,6 @@ acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc)
 
 	/* Get the AML pointer (method object) and bank_field node */
 
-	extra_desc = acpi_ns_get_secondary_object(obj_desc);
 	node = obj_desc->bank_field.node;
 
 	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
@@ -258,8 +254,8 @@ acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc)
 	/* Execute the AML code for the term_arg arguments */
 
 	status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
-					   extra_desc->extra.aml_length,
-					   extra_desc->extra.aml_start);
+					   obj_desc->bank_field.aml_length,
+					   obj_desc->bank_field.aml_start);
 	return_ACPI_STATUS(status);
 }
 
@@ -368,7 +364,6 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
 {
 	struct acpi_namespace_node *node;
 	acpi_status status;
-	union acpi_operand_object *extra_desc;
 
 	ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc);
 
@@ -376,11 +371,6 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
 		return_ACPI_STATUS(AE_OK);
 	}
 
-	extra_desc = acpi_ns_get_secondary_object(obj_desc);
-	if (!extra_desc) {
-		return_ACPI_STATUS(AE_NOT_EXIST);
-	}
-
 	/* Get the Region node */
 
 	node = obj_desc->region.node;
@@ -390,13 +380,13 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
 
 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
 			  acpi_ut_get_node_name(node),
-			  extra_desc->extra.aml_start));
+			  obj_desc->region.aml_start));
 
 	/* Execute the argument AML */
 
 	status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
-					   extra_desc->extra.aml_length,
-					   extra_desc->extra.aml_start);
+					   obj_desc->region.aml_length,
+					   obj_desc->region.aml_start);
 	return_ACPI_STATUS(status);
 }
 
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 538d632..2f02fc0 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -199,17 +199,11 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
 {
 	struct acpi_evaluate_info *info;
 	union acpi_operand_object *args[3];
-	union acpi_operand_object *region_obj2;
 	acpi_status status;
 
 	ACPI_FUNCTION_TRACE(ev_execute_reg_method);
 
-	region_obj2 = acpi_ns_get_secondary_object(region_obj);
-	if (!region_obj2) {
-		return_ACPI_STATUS(AE_NOT_EXIST);
-	}
-
-	if (region_obj2->extra.method_REG == NULL) {
+	if (region_obj->region.method_REG == NULL) {
 		return_ACPI_STATUS(AE_OK);
 	}
 
@@ -220,7 +214,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
 		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
-	info->prefix_node = region_obj2->extra.method_REG;
+	info->prefix_node = region_obj->region.method_REG;
 	info->pathname = NULL;
 	info->parameters = args;
 	info->flags = ACPI_IGNORE_RETURN_VALUE;
@@ -297,16 +291,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
 	acpi_adr_space_handler handler;
 	acpi_adr_space_setup region_setup;
 	union acpi_operand_object *handler_desc;
-	union acpi_operand_object *region_obj2;
 	void *region_context = NULL;
 
 	ACPI_FUNCTION_TRACE(ev_address_space_dispatch);
 
-	region_obj2 = acpi_ns_get_secondary_object(region_obj);
-	if (!region_obj2) {
-		return_ACPI_STATUS(AE_NOT_EXIST);
-	}
-
 	/* Ensure that there is a handler associated with this region */
 
 	handler_desc = region_obj->region.handler;
@@ -373,7 +361,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
 		if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) {
 			region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
 
-			if (region_obj2->extra.region_context) {
+			if (region_obj->region.region_context) {
 
 				/* The handler for this region was already installed */
 
@@ -383,7 +371,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
 				 * Save the returned context for use in all accesses to
 				 * this particular region
 				 */
-				region_obj2->extra.region_context =
+				region_obj->region.region_context =
 				    region_context;
 			}
 		}
@@ -414,7 +402,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
 
 	status = handler(function, address, bit_width, value,
 			 handler_desc->address_space.context,
-			 region_obj2->extra.region_context);
+			 region_obj->region.region_context);
 
 	if (ACPI_FAILURE(status)) {
 		ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]",
@@ -457,16 +445,11 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
 	union acpi_operand_object **last_obj_ptr;
 	acpi_adr_space_setup region_setup;
 	void **region_context;
-	union acpi_operand_object *region_obj2;
 	acpi_status status;
 
 	ACPI_FUNCTION_TRACE(ev_detach_region);
 
-	region_obj2 = acpi_ns_get_secondary_object(region_obj);
-	if (!region_obj2) {
-		return_VOID;
-	}
-	region_context = &region_obj2->extra.region_context;
+	region_context = &region_obj->region.region_context;
 
 	/* Get the address handler from the region object */
 
@@ -900,10 +883,6 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
 			goto unlock_and_exit;
 		}
 
-		/* Init new descriptor */
-
-		obj_desc->common.type = (u8) type;
-
 		/* Attach the new object to the Node */
 
 		status = acpi_ns_attach_object(node, obj_desc, type);
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 284a7be..147e427 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -533,7 +533,6 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
 	acpi_status status;
 	struct acpi_namespace_node *method_node;
 	acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
-	union acpi_operand_object *region_obj2;
 
 	ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked);
 
@@ -545,18 +544,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
 		return_ACPI_STATUS(AE_OK);
 	}
 
-	region_obj2 = acpi_ns_get_secondary_object(region_obj);
-	if (!region_obj2) {
-		return_ACPI_STATUS(AE_NOT_EXIST);
-	}
-
 	node = acpi_ns_get_parent_node(region_obj->region.node);
 	space_id = region_obj->region.space_id;
 
 	/* Setup defaults */
 
 	region_obj->region.handler = NULL;
-	region_obj2->extra.method_REG = NULL;
+	region_obj->region.method_REG = NULL;
 	region_obj->common.flags &= ~(AOPOBJ_SETUP_COMPLETE);
 	region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;
 
@@ -571,7 +565,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
 		 * definition. This will be executed when the handler is attached
 		 * or removed
 		 */
-		region_obj2->extra.method_REG = method_node;
+		region_obj->region.method_REG = method_node;
 	}
 
 	/*
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index a57ad25..598dc5e 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -284,7 +284,6 @@ acpi_ex_create_region(u8 * aml_start,
 	acpi_status status;
 	union acpi_operand_object *obj_desc;
 	struct acpi_namespace_node *node;
-	union acpi_operand_object *region_obj2;
 
 	ACPI_FUNCTION_TRACE(ex_create_region);
 
@@ -326,9 +325,8 @@ acpi_ex_create_region(u8 * aml_start,
 	 * Remember location in AML stream of address & length
 	 * operands since they need to be evaluated at run time.
 	 */
-	region_obj2 = obj_desc->common.next_object;
-	region_obj2->extra.aml_start = aml_start;
-	region_obj2->extra.aml_length = aml_length;
+	obj_desc->region.aml_start = aml_start;
+	obj_desc->region.aml_length = aml_length;
 
 	/* Init the region from the operands */
 
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index 52fec07..6819e18 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -413,7 +413,6 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
 acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
 {
 	union acpi_operand_object *obj_desc;
-	union acpi_operand_object *second_desc = NULL;
 	u32 type;
 	acpi_status status;
 
@@ -502,11 +501,10 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
 		 * opcode and operands -- since the bank_value
 		 * operands must be evaluated.
 		 */
-		second_desc = obj_desc->common.next_object;
-		second_desc->extra.aml_start =
+		obj_desc->bank_field.aml_start =
 		    ACPI_CAST_PTR(union acpi_parse_object,
 				  info->data_register_node)->named.data;
-		second_desc->extra.aml_length =
+		obj_desc->bank_field.aml_length =
 		    ACPI_CAST_PTR(union acpi_parse_object,
 				  info->data_register_node)->named.length;
 
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c
index 3eb20bf..dfd7184 100644
--- a/drivers/acpi/acpica/nsobject.c
+++ b/drivers/acpi/acpica/nsobject.c
@@ -274,36 +274,6 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ns_get_secondary_object
- *
- * PARAMETERS:  Node             - Namespace node
- *
- * RETURN:      Current value of the object field from the Node whose
- *              handle is passed.
- *
- * DESCRIPTION: Obtain a secondary object associated with a namespace node.
- *
- ******************************************************************************/
-
-union acpi_operand_object *acpi_ns_get_secondary_object(union
-							acpi_operand_object
-							*obj_desc)
-{
-	ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc);
-
-	if ((!obj_desc) ||
-	    (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) ||
-	    (!obj_desc->common.next_object) ||
-	    ((obj_desc->common.next_object)->common.type ==
-	     ACPI_TYPE_LOCAL_DATA)) {
-		return_PTR(NULL);
-	}
-
-	return_PTR(obj_desc->common.next_object);
-}
-
-/*******************************************************************************
- *
  * FUNCTION:    acpi_ns_attach_data
  *
  * PARAMETERS:  Node            - Namespace node
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index 0f0c64b..4587c0b 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -686,7 +686,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
 	/* Copy the entire source object over the destination object */
 
 	ACPI_MEMCPY((char *)dest_desc, (char *)source_desc,
-		    sizeof(union acpi_operand_object));
+		    acpi_ut_operand_size(dest_desc->common.type));
 
 	/* Restore the saved fields */
 
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index a5ee23b..fab0266 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -73,7 +73,6 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
 {
 	void *obj_pointer = NULL;
 	union acpi_operand_object *handler_desc;
-	union acpi_operand_object *second_desc;
 	union acpi_operand_object *next_desc;
 
 	ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object);
@@ -214,61 +213,30 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
 		ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
 				  "***** Region %p\n", object));
 
-		second_desc = acpi_ns_get_secondary_object(object);
-		if (second_desc) {
-			/*
-			 * Free the region_context if and only if the handler is one of the
-			 * default handlers -- and therefore, we created the context object
-			 * locally, it was not created by an external caller.
-			 */
-			handler_desc = object->region.handler;
-			if (handler_desc) {
-				if (handler_desc->address_space.handler_flags &
-				    ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
-
-					/* Deactivate region and free region context */
-
-					if (handler_desc->address_space.setup) {
-						(void)handler_desc->
-						    address_space.setup(object,
-									ACPI_REGION_DEACTIVATE,
-									handler_desc->
-									address_space.
-									context,
-									&second_desc->
-									extra.
-									region_context);
-					}
+		/*
+		 * Free the region_context if and only if the handler is one of the
+		 * default handlers -- and therefore, we created the context object
+		 * locally, it was not created by an external caller.
+		 */
+		handler_desc = object->region.handler;
+		if (handler_desc) {
+			if (handler_desc->address_space.handler_flags &
+			    ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
+
+				/* Deactivate region and free region context */
+
+				if (handler_desc->address_space.setup) {
+					(void)handler_desc->address_space.
+					    setup(object,
+						  ACPI_REGION_DEACTIVATE,
+						  handler_desc->address_space.
+						  context,
+						  &object->region.
+						  region_context);
 				}
-
-				acpi_ut_remove_reference(handler_desc);
 			}
 
-			/* Now we can free the Extra object */
-
-			acpi_ut_delete_object_desc(second_desc);
-		}
-		break;
-
-	case ACPI_TYPE_BUFFER_FIELD:
-
-		ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
-				  "***** Buffer Field %p\n", object));
-
-		second_desc = acpi_ns_get_secondary_object(object);
-		if (second_desc) {
-			acpi_ut_delete_object_desc(second_desc);
-		}
-		break;
-
-	case ACPI_TYPE_LOCAL_BANK_FIELD:
-
-		ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
-				  "***** Bank Field %p\n", object));
-
-		second_desc = acpi_ns_get_secondary_object(object);
-		if (second_desc) {
-			acpi_ut_delete_object_desc(second_desc);
+			acpi_ut_remove_reference(handler_desc);
 		}
 		break;
 
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index 294d905..de5939d 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -62,6 +62,8 @@ acpi_ut_get_element_length(u8 object_type,
 			   union acpi_operand_object *source_object,
 			   union acpi_generic_state *state, void *context);
 
+acpi_size acpi_ut_operand_size(int type);
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_create_internal_object_dbg
@@ -74,13 +76,6 @@ acpi_ut_get_element_length(u8 object_type,
  * RETURN:      A new internal object, null on failure
  *
  * DESCRIPTION: Create and initialize a new internal object.
- *
- * NOTE:        We always allocate the worst-case object descriptor because
- *              these objects are cached, and we want them to be
- *              one-size-satisifies-any-request.  This in itself may not be
- *              the most memory efficient, but the efficiency of the object
- *              cache should more than make up for this!
- *
  ******************************************************************************/
 
 union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
@@ -91,48 +86,18 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
 							      type)
 {
 	union acpi_operand_object *object;
-	union acpi_operand_object *second_object;
 
 	ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg,
 				acpi_ut_get_type_name(type));
 
 	/* Allocate the raw object descriptor */
+	object = ACPI_ALLOCATE_ZEROED(acpi_ut_operand_size(type));
 
-	object =
-	    acpi_ut_allocate_object_desc_dbg(module_name, line_number,
-					     component_id);
 	if (!object) {
 		return_PTR(NULL);
 	}
 
-	switch (type) {
-	case ACPI_TYPE_REGION:
-	case ACPI_TYPE_BUFFER_FIELD:
-	case ACPI_TYPE_LOCAL_BANK_FIELD:
-
-		/* These types require a secondary object */
-
-		second_object = acpi_ut_allocate_object_desc_dbg(module_name,
-								 line_number,
-								 component_id);
-		if (!second_object) {
-			acpi_ut_delete_object_desc(object);
-			return_PTR(NULL);
-		}
-
-		second_object->common.type = ACPI_TYPE_LOCAL_EXTRA;
-		second_object->common.reference_count = 1;
-
-		/* Link the second object to the first */
-
-		object->common.next_object = second_object;
-		break;
-
-	default:
-		/* All others have no secondary object */
-		break;
-	}
-
+	ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
 	/* Save the object type in the object descriptor */
 
 	object->common.type = (u8) type;
@@ -335,47 +300,6 @@ u8 acpi_ut_valid_internal_object(void *object)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ut_allocate_object_desc_dbg
- *
- * PARAMETERS:  module_name         - Caller's module name (for error output)
- *              line_number         - Caller's line number (for error output)
- *              component_id        - Caller's component ID (for error output)
- *
- * RETURN:      Pointer to newly allocated object descriptor.  Null on error
- *
- * DESCRIPTION: Allocate a new object descriptor.  Gracefully handle
- *              error conditions.
- *
- ******************************************************************************/
-
-void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
-				       u32 line_number, u32 component_id)
-{
-	union acpi_operand_object *object;
-
-	ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg);
-
-	object = ACPI_ALLOCATE_ZEROED(sizeof(union acpi_operand_object));
-	if (!object) {
-		ACPI_ERROR((module_name, line_number,
-			    "Could not allocate an object descriptor"));
-
-		return_PTR(NULL);
-	}
-
-	/* Mark the descriptor type */
-
-	memset(object, 0, sizeof(union acpi_operand_object));
-	ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
-
-	ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
-			  object, (u32) sizeof(union acpi_operand_object)));
-
-	return_PTR(object);
-}
-
-/*******************************************************************************
- *
  * FUNCTION:    acpi_ut_delete_object_desc
  *
  * PARAMETERS:  Object          - An Acpi internal object to be deleted
@@ -403,6 +327,78 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
 	return_VOID;
 }
 
+acpi_size acpi_ut_operand_size(int type)
+{
+	acpi_size obj_size = 0;
+
+	switch (type) {
+	case ACPI_TYPE_INTEGER:
+		obj_size = sizeof(struct acpi_object_integer);
+		break;
+	case ACPI_TYPE_BUFFER_FIELD:
+		obj_size = sizeof(struct acpi_object_buffer_field);
+		break;
+	case ACPI_TYPE_LOCAL_BANK_FIELD:
+		obj_size = sizeof(struct acpi_object_bank_field);
+		break;
+	case ACPI_TYPE_LOCAL_INDEX_FIELD:
+		obj_size = sizeof(struct acpi_object_index_field);
+		break;
+	case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
+		obj_size = sizeof(struct acpi_object_addr_handler);
+		break;
+	case ACPI_TYPE_MUTEX:
+		obj_size = sizeof(struct acpi_object_mutex);
+		break;
+	case ACPI_TYPE_REGION:
+		obj_size = sizeof(struct acpi_object_region);
+		break;
+	case ACPI_TYPE_STRING:
+		obj_size = sizeof(struct acpi_object_string);
+		break;
+	case ACPI_TYPE_BUFFER:
+		obj_size = sizeof(struct acpi_object_buffer);
+		break;
+	case ACPI_TYPE_PACKAGE:
+		obj_size = sizeof(struct acpi_object_package);
+		break;
+	case ACPI_TYPE_EVENT:
+		obj_size = sizeof(struct acpi_object_event);
+		break;
+	case ACPI_TYPE_METHOD:
+		obj_size = sizeof(struct acpi_object_method);
+		break;
+	case ACPI_TYPE_DEVICE:
+		obj_size = sizeof(struct acpi_object_device);
+		break;
+	case ACPI_TYPE_POWER:
+		obj_size = sizeof(struct acpi_object_power_resource);
+		break;
+	case ACPI_TYPE_PROCESSOR:
+		obj_size = sizeof(struct acpi_object_processor);
+		break;
+	case ACPI_TYPE_THERMAL:
+		obj_size = sizeof(struct acpi_object_thermal_zone);
+		break;
+	case ACPI_TYPE_LOCAL_REGION_FIELD:
+		obj_size = sizeof(struct acpi_object_region_field);
+		break;
+	case ACPI_TYPE_LOCAL_NOTIFY:
+		obj_size = sizeof(struct acpi_object_notify_handler);
+		break;
+	case ACPI_TYPE_LOCAL_REFERENCE:
+		obj_size = sizeof(struct acpi_object_reference);
+		break;
+	case ACPI_TYPE_LOCAL_DATA:
+		obj_size = sizeof(struct acpi_object_data);
+		break;
+	default:
+		ACPI_ERROR((AE_INFO, "Unexpected type of object descriptor"));
+		return 0;
+	}
+	return obj_size;
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_simple_object_size
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 21abd7a..eb98f19 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -588,7 +588,6 @@ typedef u32 acpi_object_type;
  * These are special object types that never appear in
  * a Namespace node, only in a union acpi_operand_object
  */
-#define ACPI_TYPE_LOCAL_EXTRA           0x1C
 #define ACPI_TYPE_LOCAL_DATA            0x1D
 
 #define ACPI_TYPE_LOCAL_MAX             0x1D

[-- Attachment #4: [PATCH_3_4]_ACPICA:_Delete_NextObject_pointer --]
[-- Type: text/plain, Size: 7860 bytes --]

    ACPICA: Delete NextObject pointer
    
    NextObject field was used for double objects (removed by prev patch) and
    for data objects. Data object size is now untangled from all other object
    sizes, so we can save size of pointer in all object allocations.
    
    Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---
 drivers/acpi/acpica/aclocal.h  |    4 ++--
 drivers/acpi/acpica/acobject.h |    5 ++---
 drivers/acpi/acpica/nsobject.c |   36 +++++++-----------------------------
 drivers/acpi/acpica/utcopy.c   |   11 +++++++----
 4 files changed, 18 insertions(+), 38 deletions(-)

diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 772ee5c..7cd8ca5 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -178,7 +178,6 @@ typedef enum {
  * structures.
  */
 struct acpi_namespace_node {
-	union acpi_operand_object *object;	/* Interpreter object */
 	u8 descriptor_type;	/* Differentiate object descriptor types */
 	u8 type;		/* ACPI Type associated with this name */
 	u8 flags;		/* Miscellaneous flags */
@@ -186,6 +185,7 @@ struct acpi_namespace_node {
 	union acpi_name_union name;	/* ACPI Name, always 4 chars per ACPI spec */
 	struct acpi_namespace_node *child;	/* First child */
 	struct acpi_namespace_node *peer;	/* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
+	union acpi_operand_object *object;	/* Interpreter object */
 
 	/*
 	 * The following fields are used by the ASL compiler and disassembler only
@@ -651,11 +651,11 @@ union acpi_parse_value {
 #endif
 
 #define ACPI_PARSE_COMMON \
-	union acpi_parse_object         *parent;        /* Parent op */\
 	u8                              descriptor_type; /* To differentiate various internal objs */\
 	u8                              flags;          /* Type of Op */\
 	u16                             aml_opcode;     /* AML opcode */\
 	u32                             aml_offset;     /* Offset of declaration in AML */\
+	union acpi_parse_object         *parent;        /* Parent op */\
 	union acpi_parse_object         *next;          /* Next op */\
 	struct acpi_namespace_node      *node;          /* For use by interpreter */\
 	union acpi_parse_value          value;          /* Value or args associated with the opcode */\
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index fdafe1a..91e892a 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -79,7 +79,6 @@
  * structures.
  */
 #define ACPI_OBJECT_COMMON_HEADER \
-	union acpi_operand_object       *next_object;       /* Objects linked to parent NS node */\
 	u8                              descriptor_type;    /* To differentiate various internal objs */\
 	u8                              type;               /* acpi_object_type */\
 	u16                             reference_count;    /* For object deletion management */\
@@ -346,7 +345,8 @@ typedef enum {
 /* Additional data that can be attached to namespace nodes */
 
 struct acpi_object_data {
-	ACPI_OBJECT_COMMON_HEADER acpi_object_handler handler;
+	ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next;	/* Objects linked to parent NS node */
+	acpi_object_handler handler;
 	void *pointer;
 };
 
@@ -415,7 +415,6 @@ union acpi_operand_object {
 #define ACPI_DESC_TYPE_MAX              0x0F
 
 struct acpi_common_descriptor {
-	void *common_pointer;
 	u8 descriptor_type;	/* To differentiate various internal objs */
 };
 
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c
index dfd7184..5e41985 100644
--- a/drivers/acpi/acpica/nsobject.c
+++ b/drivers/acpi/acpica/nsobject.c
@@ -74,7 +74,6 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
 		      union acpi_operand_object *object, acpi_object_type type)
 {
 	union acpi_operand_object *obj_desc;
-	union acpi_operand_object *last_obj_desc;
 	acpi_object_type object_type = ACPI_TYPE_ANY;
 
 	ACPI_FUNCTION_TRACE(ns_attach_object);
@@ -167,18 +166,6 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
 		 */
 		acpi_ut_add_reference(obj_desc);
 
-		/*
-		 * Handle objects with multiple descriptors - walk
-		 * to the end of the descriptor list
-		 */
-		last_obj_desc = obj_desc;
-		while (last_obj_desc->common.next_object) {
-			last_obj_desc = last_obj_desc->common.next_object;
-		}
-
-		/* Install the object at the front of the object list */
-
-		last_obj_desc->common.next_object = node->object;
 	}
 
 	node->type = (u8) object_type;
@@ -216,13 +203,6 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node)
 	/* Clear the entry in all cases */
 
 	node->object = NULL;
-	if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) {
-		node->object = obj_desc->common.next_object;
-		if (node->object &&
-		    ((node->object)->common.type != ACPI_TYPE_LOCAL_DATA)) {
-			node->object = node->object->common.next_object;
-		}
-	}
 
 	/* Reset the node type to untyped */
 
@@ -299,13 +279,12 @@ acpi_ns_attach_data(struct acpi_namespace_node *node,
 	prev_obj_desc = NULL;
 	obj_desc = node->object;
 	while (obj_desc) {
-		if ((obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) &&
-		    (obj_desc->data.handler == handler)) {
+		if (obj_desc->data.handler == handler) {
 			return (AE_ALREADY_EXISTS);
 		}
 
 		prev_obj_desc = obj_desc;
-		obj_desc = obj_desc->common.next_object;
+		obj_desc = obj_desc->data.next;
 	}
 
 	/* Create an internal object for the data */
@@ -321,7 +300,7 @@ acpi_ns_attach_data(struct acpi_namespace_node *node,
 	/* Install the data object */
 
 	if (prev_obj_desc) {
-		prev_obj_desc->common.next_object = data_desc;
+		prev_obj_desc->data.next = data_desc;
 	} else {
 		node->object = data_desc;
 	}
@@ -356,10 +335,9 @@ acpi_ns_detach_data(struct acpi_namespace_node * node,
 		if ((obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) &&
 		    (obj_desc->data.handler == handler)) {
 			if (prev_obj_desc) {
-				prev_obj_desc->common.next_object =
-				    obj_desc->common.next_object;
+				prev_obj_desc->data.next = obj_desc->data.next;
 			} else {
-				node->object = obj_desc->common.next_object;
+				node->object = obj_desc->data.next;
 			}
 
 			acpi_ut_remove_reference(obj_desc);
@@ -367,7 +345,7 @@ acpi_ns_detach_data(struct acpi_namespace_node * node,
 		}
 
 		prev_obj_desc = obj_desc;
-		obj_desc = obj_desc->common.next_object;
+		obj_desc = obj_desc->data.next;
 	}
 
 	return (AE_NOT_FOUND);
@@ -402,7 +380,7 @@ acpi_ns_get_attached_data(struct acpi_namespace_node * node,
 			return (AE_OK);
 		}
 
-		obj_desc = obj_desc->common.next_object;
+		obj_desc = obj_desc->data.next;
 	}
 
 	return (AE_NOT_FOUND);
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index 4587c0b..d51ac0b 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -675,13 +675,15 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
 			   union acpi_operand_object *dest_desc)
 {
 	u16 reference_count;
-	union acpi_operand_object *next_object;
+	union acpi_operand_object *next_object = NULL;
 	acpi_status status;
 
 	/* Save fields from destination that we don't want to overwrite */
 
 	reference_count = dest_desc->common.reference_count;
-	next_object = dest_desc->common.next_object;
+	if (dest_desc->common.type == ACPI_TYPE_LOCAL_DATA) {
+		next_object = dest_desc->data.next;
+	}
 
 	/* Copy the entire source object over the destination object */
 
@@ -691,8 +693,9 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
 	/* Restore the saved fields */
 
 	dest_desc->common.reference_count = reference_count;
-	dest_desc->common.next_object = next_object;
-
+	if (dest_desc->common.type == ACPI_TYPE_LOCAL_DATA) {
+		dest_desc->data.next = next_object;
+	}
 	/* New object is not static, regardless of source */
 
 	dest_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;

[-- Attachment #5: [PATCH_4_4]_ACPICA:_Remove_linux_cache_code --]
[-- Type: text/plain, Size: 4150 bytes --]

    ACPICA: Remove linux specific cache code

    Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
 drivers/acpi/osl.c              |   95 ---------------------------------------
 include/acpi/platform/aclinux.h |    6 ---
 2 files changed, 0 insertions(+), 101 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index d59f08e..32a6521 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1210,101 +1210,6 @@ void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags)
 
 #ifndef ACPI_USE_LOCAL_CACHE
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_os_create_cache
- *
- * PARAMETERS:  name      - Ascii name for the cache
- *              size      - Size of each cached object
- *              depth     - Maximum depth of the cache (in objects) <ignored>
- *              cache     - Where the new cache object is returned
- *
- * RETURN:      status
- *
- * DESCRIPTION: Create a cache object
- *
- ******************************************************************************/
-
-acpi_status
-acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
-{
-	*cache = kmem_cache_create(name, size, 0, 0, NULL);
-	if (*cache == NULL)
-		return AE_ERROR;
-	else
-		return AE_OK;
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_os_purge_cache
- *
- * PARAMETERS:  Cache           - Handle to cache object
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Free all objects within the requested cache.
- *
- ******************************************************************************/
-
-acpi_status acpi_os_purge_cache(acpi_cache_t * cache)
-{
-	kmem_cache_shrink(cache);
-	return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_os_delete_cache
- *
- * PARAMETERS:  Cache           - Handle to cache object
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Free all objects within the requested cache and delete the
- *              cache object.
- *
- ******************************************************************************/
-
-acpi_status acpi_os_delete_cache(acpi_cache_t * cache)
-{
-	kmem_cache_destroy(cache);
-	return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_os_release_object
- *
- * PARAMETERS:  Cache       - Handle to cache object
- *              Object      - The object to be released
- *
- * RETURN:      None
- *
- * DESCRIPTION: Release an object to the specified cache.  If cache is full,
- *              the object is deleted.
- *
- ******************************************************************************/
-
-acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
-{
-	kmem_cache_free(cache, object);
-	return (AE_OK);
-}
-
-/******************************************************************************
- *
- * FUNCTION:    acpi_os_validate_interface
- *
- * PARAMETERS:  interface           - Requested interface to be validated
- *
- * RETURN:      AE_OK if interface is supported, AE_SUPPORT otherwise
- *
- * DESCRIPTION: Match an interface string to the interfaces supported by the
- *              host. Strings originate from an AML call to the _OSI method.
- *
- *****************************************************************************/
-
 acpi_status
 acpi_os_validate_interface (char *interface)
 {
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 43bacf2..36d006a 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -137,12 +137,6 @@ static inline void *acpi_os_allocate_zeroed(acpi_size size)
 	return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
 }
 
-static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
-{
-	return kmem_cache_zalloc(cache,
-		irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
-}
-
 #define ACPI_ALLOCATE(a)        acpi_os_allocate(a)
 #define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
 #define ACPI_FREE(a)            kfree(a)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH 1/4] ACPICA: Remove use of caches in controlled way
  2009-05-11  8:14 ` [PATCH 1/4] ACPICA: Remove use of caches in controlled way Lin Ming
@ 2009-05-11 15:42   ` Moore, Robert
  2009-05-12 18:54     ` Alexey Starikovskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Moore, Robert @ 2009-05-11 15:42 UTC (permalink / raw)
  To: Lin, Ming M, Alexey Starikovskiy; +Cc: Linux-acpi@vger.kernel.org

Removing the cache has exposed a couple of bugs that we are currently working on. We need to make sure that we pass the ASLTS suite before the code is integrated/released.

Bob


>-----Original Message-----
>From: Lin, Ming M
>Sent: Monday, May 11, 2009 1:14 AM
>To: Alexey Starikovskiy
>Cc: Moore, Robert; Linux-acpi@vger.kernel.org
>Subject: Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled way
>
>Hi, Alexey
>
>The attachment are the linuxized version of your patches.
>I added another patch (the 4th) to remove linux specific cache code.
>
>The patches are applied on top of linux-acpi-2.6/acpica branch.
>
>Do you have any suggestion what data I should collect to verify if these
>patches have a performance gain?
>
>Lin Ming
>
>On Thu, 2009-05-07 at 23:52 +0800, Alexey Starikovskiy wrote:
>> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
>> ---
>>
>>  source/components/utilities/utcache.c |   99 +++++----------------------
>------
>>  1 files changed, 14 insertions(+), 85 deletions(-)
>>
>>
>> diff --git a/source/components/utilities/utcache.c
>b/source/components/utilities/utcache.c
>> index aabc0a2..d08d520 100644
>> --- a/source/components/utilities/utcache.c
>> +++ b/source/components/utilities/utcache.c
>> @@ -287,49 +287,15 @@ AcpiOsReleaseObject (
>>      ACPI_MEMORY_LIST        *Cache,
>>      void                    *Object)
>>  {
>> -    ACPI_STATUS             Status;
>> -
>> -
>>      ACPI_FUNCTION_ENTRY ();
>>
>> -
>>      if (!Cache || !Object)
>>      {
>>          return (AE_BAD_PARAMETER);
>>      }
>>
>> -    /* 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 */
>> -
>> -    else
>> -    {
>> -        Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
>> -        if (ACPI_FAILURE (Status))
>> -        {
>> -            return (Status);
>> -        }
>> -
>> -        /* Mark the object as cached */
>> -
>> -        ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
>> -        ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
>> -
>> -        /* Put the object at the head of the cache list */
>> -
>> -        * (ACPI_CAST_INDIRECT_PTR (char,
>> -            &(((char *) Object)[Cache->LinkOffset]))) = Cache->ListHead;
>> -        Cache->ListHead = Object;
>> -        Cache->CurrentDepth++;
>> -
>> -        (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>> -    }
>> +    ACPI_FREE (Object);
>> +    ACPI_MEM_TRACKING (Cache->TotalFreed++);
>>
>>      return (AE_OK);
>>  }
>> @@ -353,8 +319,6 @@ AcpiOsAcquireObject (
>>      ACPI_MEMORY_LIST        *Cache)
>>  {
>>      ACPI_STATUS             Status;
>> -    void                    *Object;
>> -
>>
>>      ACPI_FUNCTION_NAME (OsAcquireObject);
>>
>> @@ -372,61 +336,26 @@ AcpiOsAcquireObject (
>>
>>      ACPI_MEM_TRACKING (Cache->Requests++);
>>
>> -    /* Check the cache first */
>> +    /* The cache is empty, create a new object */
>>
>> -    if (Cache->ListHead)
>> -    {
>> -        /* There is an object available, use it */
>> -
>> -        Object = Cache->ListHead;
>> -        Cache->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
>> -                                &(((char *) Object)[Cache-
>>LinkOffset])));
>> -
>> -        Cache->CurrentDepth--;
>> -
>> -        ACPI_MEM_TRACKING (Cache->Hits++);
>> -        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
>> -            "Object %p from %s cache\n", Object, Cache->ListName));
>> -
>> -        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>> -        if (ACPI_FAILURE (Status))
>> -        {
>> -            return (NULL);
>> -        }
>> -
>> -        /* Clear (zero) the previously used Object */
>> -
>> -        ACPI_MEMSET (Object, 0, Cache->ObjectSize);
>> -    }
>> -    else
>> -    {
>> -        /* The cache is empty, create a new object */
>> -
>> -        ACPI_MEM_TRACKING (Cache->TotalAllocated++);
>> +    ACPI_MEM_TRACKING (Cache->TotalAllocated++);
>>
>>  #ifdef ACPI_DBG_TRACK_ALLOCATIONS
>> -        if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache-
>>MaxOccupied)
>> -        {
>> -            Cache->MaxOccupied = Cache->TotalAllocated - Cache-
>>TotalFreed;
>> -        }
>> +    if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache-
>>MaxOccupied)
>> +    {
>> +        Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed;
>> +    }
>>  #endif
>>
>> -        /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
>> +    /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
>>
>> -        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>> -        if (ACPI_FAILURE (Status))
>> -        {
>> -            return (NULL);
>> -        }
>> -
>> -        Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
>> -        if (!Object)
>> -        {
>> -            return (NULL);
>> -        }
>> +    Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>> +    if (ACPI_FAILURE (Status))
>> +    {
>> +        return (NULL);
>>      }
>>
>> -    return (Object);
>> +    return ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
>>  }
>>  #endif /* ACPI_USE_LOCAL_CACHE */
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled way
  2009-05-11 15:42   ` Moore, Robert
@ 2009-05-12 18:54     ` Alexey Starikovskiy
  2009-05-12 21:28       ` Moore, Robert
  0 siblings, 1 reply; 8+ messages in thread
From: Alexey Starikovskiy @ 2009-05-12 18:54 UTC (permalink / raw)
  To: Moore, Robert
  Cc: Lin, Ming M, Alexey Starikovskiy, Linux-acpi@vger.kernel.org

What bugs are you seeing? May I be of any help?

Regards,
Alex.


Moore, Robert wrote:
> Removing the cache has exposed a couple of bugs that we are currently working on. We need to make sure that we pass the ASLTS suite before the code is integrated/released.
>
> Bob
>
>
>   
>> -----Original Message-----
>> From: Lin, Ming M
>> Sent: Monday, May 11, 2009 1:14 AM
>> To: Alexey Starikovskiy
>> Cc: Moore, Robert; Linux-acpi@vger.kernel.org
>> Subject: Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled way
>>
>> Hi, Alexey
>>
>> The attachment are the linuxized version of your patches.
>> I added another patch (the 4th) to remove linux specific cache code.
>>
>> The patches are applied on top of linux-acpi-2.6/acpica branch.
>>
>> Do you have any suggestion what data I should collect to verify if these
>> patches have a performance gain?
>>
>> Lin Ming
>>
>> On Thu, 2009-05-07 at 23:52 +0800, Alexey Starikovskiy wrote:
>>     
>>> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
>>> ---
>>>
>>>  source/components/utilities/utcache.c |   99 +++++----------------------
>>>       
>> ------
>>     
>>>  1 files changed, 14 insertions(+), 85 deletions(-)
>>>
>>>
>>> diff --git a/source/components/utilities/utcache.c
>>>       
>> b/source/components/utilities/utcache.c
>>     
>>> index aabc0a2..d08d520 100644
>>> --- a/source/components/utilities/utcache.c
>>> +++ b/source/components/utilities/utcache.c
>>> @@ -287,49 +287,15 @@ AcpiOsReleaseObject (
>>>      ACPI_MEMORY_LIST        *Cache,
>>>      void                    *Object)
>>>  {
>>> -    ACPI_STATUS             Status;
>>> -
>>> -
>>>      ACPI_FUNCTION_ENTRY ();
>>>
>>> -
>>>      if (!Cache || !Object)
>>>      {
>>>          return (AE_BAD_PARAMETER);
>>>      }
>>>
>>> -    /* 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 */
>>> -
>>> -    else
>>> -    {
>>> -        Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
>>> -        if (ACPI_FAILURE (Status))
>>> -        {
>>> -            return (Status);
>>> -        }
>>> -
>>> -        /* Mark the object as cached */
>>> -
>>> -        ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
>>> -        ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
>>> -
>>> -        /* Put the object at the head of the cache list */
>>> -
>>> -        * (ACPI_CAST_INDIRECT_PTR (char,
>>> -            &(((char *) Object)[Cache->LinkOffset]))) = Cache->ListHead;
>>> -        Cache->ListHead = Object;
>>> -        Cache->CurrentDepth++;
>>> -
>>> -        (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>>> -    }
>>> +    ACPI_FREE (Object);
>>> +    ACPI_MEM_TRACKING (Cache->TotalFreed++);
>>>
>>>      return (AE_OK);
>>>  }
>>> @@ -353,8 +319,6 @@ AcpiOsAcquireObject (
>>>      ACPI_MEMORY_LIST        *Cache)
>>>  {
>>>      ACPI_STATUS             Status;
>>> -    void                    *Object;
>>> -
>>>
>>>      ACPI_FUNCTION_NAME (OsAcquireObject);
>>>
>>> @@ -372,61 +336,26 @@ AcpiOsAcquireObject (
>>>
>>>      ACPI_MEM_TRACKING (Cache->Requests++);
>>>
>>> -    /* Check the cache first */
>>> +    /* The cache is empty, create a new object */
>>>
>>> -    if (Cache->ListHead)
>>> -    {
>>> -        /* There is an object available, use it */
>>> -
>>> -        Object = Cache->ListHead;
>>> -        Cache->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
>>> -                                &(((char *) Object)[Cache-
>>> LinkOffset])));
>>> -
>>> -        Cache->CurrentDepth--;
>>> -
>>> -        ACPI_MEM_TRACKING (Cache->Hits++);
>>> -        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
>>> -            "Object %p from %s cache\n", Object, Cache->ListName));
>>> -
>>> -        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>>> -        if (ACPI_FAILURE (Status))
>>> -        {
>>> -            return (NULL);
>>> -        }
>>> -
>>> -        /* Clear (zero) the previously used Object */
>>> -
>>> -        ACPI_MEMSET (Object, 0, Cache->ObjectSize);
>>> -    }
>>> -    else
>>> -    {
>>> -        /* The cache is empty, create a new object */
>>> -
>>> -        ACPI_MEM_TRACKING (Cache->TotalAllocated++);
>>> +    ACPI_MEM_TRACKING (Cache->TotalAllocated++);
>>>
>>>  #ifdef ACPI_DBG_TRACK_ALLOCATIONS
>>> -        if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache-
>>> MaxOccupied)
>>> -        {
>>> -            Cache->MaxOccupied = Cache->TotalAllocated - Cache-
>>> TotalFreed;
>>> -        }
>>> +    if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache-
>>> MaxOccupied)
>>> +    {
>>> +        Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed;
>>> +    }
>>>  #endif
>>>
>>> -        /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
>>> +    /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
>>>
>>> -        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>>> -        if (ACPI_FAILURE (Status))
>>> -        {
>>> -            return (NULL);
>>> -        }
>>> -
>>> -        Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
>>> -        if (!Object)
>>> -        {
>>> -            return (NULL);
>>> -        }
>>> +    Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>>> +    if (ACPI_FAILURE (Status))
>>> +    {
>>> +        return (NULL);
>>>      }
>>>
>>> -    return (Object);
>>> +    return ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
>>>  }
>>>  #endif /* ACPI_USE_LOCAL_CACHE */
>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>       
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 1/4] ACPICA: Remove use of caches in controlled way
  2009-05-12 18:54     ` Alexey Starikovskiy
@ 2009-05-12 21:28       ` Moore, Robert
  0 siblings, 0 replies; 8+ messages in thread
From: Moore, Robert @ 2009-05-12 21:28 UTC (permalink / raw)
  To: Alexey Starikovskiy
  Cc: Lin, Ming M, Alexey Starikovskiy, Linux-acpi@vger.kernel.org

Problems with deletion of the DdbHandle object type. I think we have it under control, thanks.


>-----Original Message-----
>From: Alexey Starikovskiy [mailto:aystarik@gmail.com]
>Sent: Tuesday, May 12, 2009 11:54 AM
>To: Moore, Robert
>Cc: Lin, Ming M; Alexey Starikovskiy; Linux-acpi@vger.kernel.org
>Subject: Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled way
>
>What bugs are you seeing? May I be of any help?
>
>Regards,
>Alex.
>
>
>Moore, Robert wrote:
>> Removing the cache has exposed a couple of bugs that we are currently
>working on. We need to make sure that we pass the ASLTS suite before the
>code is integrated/released.
>>
>> Bob
>>
>>
>>
>>> -----Original Message-----
>>> From: Lin, Ming M
>>> Sent: Monday, May 11, 2009 1:14 AM
>>> To: Alexey Starikovskiy
>>> Cc: Moore, Robert; Linux-acpi@vger.kernel.org
>>> Subject: Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled way
>>>
>>> Hi, Alexey
>>>
>>> The attachment are the linuxized version of your patches.
>>> I added another patch (the 4th) to remove linux specific cache code.
>>>
>>> The patches are applied on top of linux-acpi-2.6/acpica branch.
>>>
>>> Do you have any suggestion what data I should collect to verify if these
>>> patches have a performance gain?
>>>
>>> Lin Ming
>>>
>>> On Thu, 2009-05-07 at 23:52 +0800, Alexey Starikovskiy wrote:
>>>
>>>> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
>>>> ---
>>>>
>>>>  source/components/utilities/utcache.c |   99 +++++--------------------
>--
>>>>
>>> ------
>>>
>>>>  1 files changed, 14 insertions(+), 85 deletions(-)
>>>>
>>>>
>>>> diff --git a/source/components/utilities/utcache.c
>>>>
>>> b/source/components/utilities/utcache.c
>>>
>>>> index aabc0a2..d08d520 100644
>>>> --- a/source/components/utilities/utcache.c
>>>> +++ b/source/components/utilities/utcache.c
>>>> @@ -287,49 +287,15 @@ AcpiOsReleaseObject (
>>>>      ACPI_MEMORY_LIST        *Cache,
>>>>      void                    *Object)
>>>>  {
>>>> -    ACPI_STATUS             Status;
>>>> -
>>>> -
>>>>      ACPI_FUNCTION_ENTRY ();
>>>>
>>>> -
>>>>      if (!Cache || !Object)
>>>>      {
>>>>          return (AE_BAD_PARAMETER);
>>>>      }
>>>>
>>>> -    /* 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 */
>>>> -
>>>> -    else
>>>> -    {
>>>> -        Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
>>>> -        if (ACPI_FAILURE (Status))
>>>> -        {
>>>> -            return (Status);
>>>> -        }
>>>> -
>>>> -        /* Mark the object as cached */
>>>> -
>>>> -        ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
>>>> -        ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
>>>> -
>>>> -        /* Put the object at the head of the cache list */
>>>> -
>>>> -        * (ACPI_CAST_INDIRECT_PTR (char,
>>>> -            &(((char *) Object)[Cache->LinkOffset]))) = Cache-
>>ListHead;
>>>> -        Cache->ListHead = Object;
>>>> -        Cache->CurrentDepth++;
>>>> -
>>>> -        (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>>>> -    }
>>>> +    ACPI_FREE (Object);
>>>> +    ACPI_MEM_TRACKING (Cache->TotalFreed++);
>>>>
>>>>      return (AE_OK);
>>>>  }
>>>> @@ -353,8 +319,6 @@ AcpiOsAcquireObject (
>>>>      ACPI_MEMORY_LIST        *Cache)
>>>>  {
>>>>      ACPI_STATUS             Status;
>>>> -    void                    *Object;
>>>> -
>>>>
>>>>      ACPI_FUNCTION_NAME (OsAcquireObject);
>>>>
>>>> @@ -372,61 +336,26 @@ AcpiOsAcquireObject (
>>>>
>>>>      ACPI_MEM_TRACKING (Cache->Requests++);
>>>>
>>>> -    /* Check the cache first */
>>>> +    /* The cache is empty, create a new object */
>>>>
>>>> -    if (Cache->ListHead)
>>>> -    {
>>>> -        /* There is an object available, use it */
>>>> -
>>>> -        Object = Cache->ListHead;
>>>> -        Cache->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
>>>> -                                &(((char *) Object)[Cache-
>>>> LinkOffset])));
>>>> -
>>>> -        Cache->CurrentDepth--;
>>>> -
>>>> -        ACPI_MEM_TRACKING (Cache->Hits++);
>>>> -        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
>>>> -            "Object %p from %s cache\n", Object, Cache->ListName));
>>>> -
>>>> -        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>>>> -        if (ACPI_FAILURE (Status))
>>>> -        {
>>>> -            return (NULL);
>>>> -        }
>>>> -
>>>> -        /* Clear (zero) the previously used Object */
>>>> -
>>>> -        ACPI_MEMSET (Object, 0, Cache->ObjectSize);
>>>> -    }
>>>> -    else
>>>> -    {
>>>> -        /* The cache is empty, create a new object */
>>>> -
>>>> -        ACPI_MEM_TRACKING (Cache->TotalAllocated++);
>>>> +    ACPI_MEM_TRACKING (Cache->TotalAllocated++);
>>>>
>>>>  #ifdef ACPI_DBG_TRACK_ALLOCATIONS
>>>> -        if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache-
>>>> MaxOccupied)
>>>> -        {
>>>> -            Cache->MaxOccupied = Cache->TotalAllocated - Cache-
>>>> TotalFreed;
>>>> -        }
>>>> +    if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache-
>>>> MaxOccupied)
>>>> +    {
>>>> +        Cache->MaxOccupied = Cache->TotalAllocated - Cache-
>>TotalFreed;
>>>> +    }
>>>>  #endif
>>>>
>>>> -        /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
>>>> +    /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
>>>>
>>>> -        Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>>>> -        if (ACPI_FAILURE (Status))
>>>> -        {
>>>> -            return (NULL);
>>>> -        }
>>>> -
>>>> -        Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
>>>> -        if (!Object)
>>>> -        {
>>>> -            return (NULL);
>>>> -        }
>>>> +    Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
>>>> +    if (ACPI_FAILURE (Status))
>>>> +    {
>>>> +        return (NULL);
>>>>      }
>>>>
>>>> -    return (Object);
>>>> +    return ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
>>>>  }
>>>>  #endif /* ACPI_USE_LOCAL_CACHE */
>>>>
>>>>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-acpi"
>in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-05-12 21:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-07 15:52 [PATCH 1/4] ACPICA: Remove use of caches in controlled way Alexey Starikovskiy
2009-05-07 15:52 ` [PATCH 2/4] ACPICA: Remove cache code Alexey Starikovskiy
2009-05-07 15:52 ` [PATCH 3/4] ACPICA: Drop Operand cache Alexey Starikovskiy
2009-05-07 15:52 ` [PATCH 4/4] ACPICA: Delete NextObject pointer Alexey Starikovskiy
2009-05-11  8:14 ` [PATCH 1/4] ACPICA: Remove use of caches in controlled way Lin Ming
2009-05-11 15:42   ` Moore, Robert
2009-05-12 18:54     ` Alexey Starikovskiy
2009-05-12 21:28       ` Moore, Robert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox