ACPICA: Remove use of caches in controlled way
Subsystems (2)
PATCH 1/4 ACPICA: Remove use of caches in controlled way
---
source/components/utilities/utcache.c | 99 +++++---------------------------- 1 files changed, 14 insertions(+), 85 deletions(-)
source/components/utilities/utcache.c +14 -85
@@ -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 */
PATCH 3/4 ACPICA: Drop Operand cache
---
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(-)
source/components/debugger/dbexec.c +0 -1
@@ -318,7 +318,6 @@ AcpiDbExecuteSetup ( } } -/******************************************************************************* * * FUNCTION: AcpiDbExecutionWalk
source/components/debugger/dbstats.c +1 -6
@@ -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" );
source/components/dispatcher/dsfield.c +2 -4
@@ -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 */
source/components/dispatcher/dsopcode.c +4 -16
@@ -283,7 +283,6 @@ ACPI_STATUSAcpiDsGetBufferFieldArguments ( 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_STATUSAcpiDsGetBankFieldArguments ( 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); }
source/components/events/evregion.c +6 -32
@@ -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);
source/components/events/evrgnini.c +2 -10
@@ -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; }/*
source/components/executer/excreate.c +2 -5
@@ -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 */
source/components/executer/exprep.c +2 -4
@@ -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 ;
source/components/namespace/nsobject.c +0 -33
@@ -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
source/components/utilities/utcopy.c +1 -1
@@ -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 */
source/components/utilities/utdelete.c +1 -37
@@ -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 ; }
source/components/utilities/utobject.c +76 -88
206 lines not on this page · raw message
source/include/acnamesp.h +0 -4
@@ -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,
source/include/acobject.h +8 -21
@@ -275,6 +275,10 @@ typedef struct acpi_object_regionunion 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_fieldACPI_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_fieldACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFOunion 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_objectACPI_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
source/include/actypes.h +0 -1
@@ -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
source/include/acutils.h +1 -1
@@ -397,7 +397,7 @@ AcpiUtCopyIobjectToIobject (ACPI_OPERAND_OBJECT **DestDesc, ACPI_WALK_STATE *WalkState); - +ACPI_SIZE AcpiUtOperandSize (int Type);/* * utcreate - Object creation */
source/os_specific/service_layers/osunixxf.c +2 -0
@@ -575,6 +575,8 @@ AcpiOsDeleteSemaphore (return (AE_BAD_PARAMETER ); } +AcpiOsFree (Sem); +return (AE_OK ); }
PATCH 2/4 ACPICA: Remove cache code
In reply to Alexey Starikovskiy---
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
source/components/debugger/dbexec.c +0 -73
@@ -138,10 +138,6 @@ static voidAcpiDbExecuteSetup (ACPI_DB_METHOD_INFO *Info); -static UINT32 -AcpiDbGetOutstandingAllocations ( -void ); - static void ACPI_SYSTEM_XFACEAcpiDbMethodThread ( 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",
source/components/debugger/dbstats.c +0 -38
@@ -189,9 +189,6 @@ static voidAcpiDbListInfo ( 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
source/components/namespace/nsalloc.c +3 -3
@@ -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 */
source/components/parser/psutils.c +4 -4
@@ -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); } }
source/components/utilities/utalloc.c +1 -60
74 lines not on this page · raw message
source/components/utilities/utcache.c deleted +0 -362
362 lines not on this page · raw message
source/components/utilities/utobject.c +2 -2
@@ -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; }
source/components/utilities/utstate.c +2 -2
@@ -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; }
source/components/utilities/utxface.c +0 -35
@@ -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 */
source/include/acconfig.h +0 -8
@@ -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?
source/include/acglobal.h +0 -8
@@ -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;
source/include/acobject.h +0 -12
@@ -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_objectACPI_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
source/include/acpiosxf.h +0 -29
@@ -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 */
source/include/actypes.h +0 -10
@@ -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 */
source/include/platform/acenv.h +0 -7
@@ -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 */
source/include/platform/acfreebsd.h +0 -1
@@ -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
source/include/platform/aclinux.h +0 -1
@@ -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 *
source/include/platform/acos2.h +0 -1
@@ -165,7 +165,6 @@ unsigned short OSPMReleaseGlobalLock (void *);#endif #ifndef ACPI_ASL_COMPILER -#define ACPI_USE_LOCAL_CACHE #undef ACPI_DEBUGGER#endif
source/tools/acpisrc/astable.c +0 -2
@@ -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},
PATCH 4/4 ACPICA: Delete NextObject pointer
In reply to Alexey StarikovskiyNextObject 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.
---
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(-)
source/components/namespace/nsobject.c +7 -31
@@ -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 );
source/components/utilities/utcopy.c +9 -4
@@ -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 ;
source/include/aclocal.h +2 -2
@@ -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_nodeACPI_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 */ \
source/include/acobject.h +1 -2
@@ -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_objecttypedef struct acpi_common_descriptor { -void *CommonPointer;UINT8 DescriptorType;/* To differentiate various internal objs */ }ACPI_COMMON_DESCRIPTOR ;
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
Quoted 148 lines · Alexey Starikovskiy
Signed-off-by Alexey Starikovskiy <[email protected]>---
source/components/utilities/utcache.c | 99 +++++---------------------------- 1 files changed, 14 insertions(+), 85 deletions(-)source/components/utilities/utcache.c +14
-86@@ -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 */ --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
ACPICA: Remove cache code
--- 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(-)
drivers/acpi/acpica/acconfig.h +0 -8
@@ -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?
drivers/acpi/acpica/acglobal.h +0 -8
@@ -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;
drivers/acpi/acpica/acobject.h +0 -7
@@ -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
drivers/acpi/acpica/nsalloc.c +3 -4
@@ -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 */
drivers/acpi/acpica/psutils.c +4 -4
@@ -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); } }
drivers/acpi/acpica/utalloc.c +1 -65
79 lines not on this page · raw message
drivers/acpi/acpica/utobject.c +2 -2
@@ -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; }
drivers/acpi/acpica/utstate.c +2 -2
@@ -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; }
drivers/acpi/acpica/utxface.c +0 -30
@@ -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
include/acpi/acpiosxf.h +0 -16
@@ -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
include/acpi/actypes.h +0 -10
@@ -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 */
include/acpi/platform/acenv.h +0 -9
@@ -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
include/acpi/platform/aclinux.h +0 -1
@@ -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 *
ACPICA: Drop Operand cache
--- 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(-)
drivers/acpi/acpica/acnamesp.h +0 -4
@@ -234,10 +234,6 @@ union acpi_operand_object *acpi_ns_get_attached_object(structacpi_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);
drivers/acpi/acpica/acobject.h +8 -15
@@ -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;/*
drivers/acpi/acpica/acutils.h +1 -0
@@ -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 */
drivers/acpi/acpica/dsfield.c +2 -4
@@ -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 */
drivers/acpi/acpica/dsopcode.c +7 -17
@@ -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); }
drivers/acpi/acpica/evregion.c +6 -27
@@ -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 = ®ion_obj2->extra.region_context; + region_context = ®ion_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);
drivers/acpi/acpica/evrgnini.c +2 -8
@@ -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; }/*
drivers/acpi/acpica/excreate.c +2 -4
@@ -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 */
drivers/acpi/acpica/exprep.c +2 -4
@@ -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;
drivers/acpi/acpica/nsobject.c +0 -30
@@ -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
drivers/acpi/acpica/utcopy.c +1 -1
@@ -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 */
drivers/acpi/acpica/utdelete.c +21 -53
89 lines not on this page · raw message
drivers/acpi/acpica/utobject.c +76 -80
196 lines not on this page · raw message
include/acpi/actypes.h +0 -1
@@ -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
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.
--- 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(-)
drivers/acpi/acpica/aclocal.h +2 -2
@@ -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 */ \
drivers/acpi/acpica/acobject.h +2 -3
@@ -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 0x0Fstruct acpi_common_descriptor { -void *common_pointer;u8 descriptor_type;/* To differentiate various internal objs */ };
drivers/acpi/acpica/nsobject.c +7 -29
@@ -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 );
drivers/acpi/acpica/utcopy.c +7 -4
@@ -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 ;
ACPICA: Remove linux specific cache code
--- drivers/acpi/osl.c | 95 --------------------------------------- include/acpi/platform/aclinux.h | 6 --- 2 files changed, 0 insertions(+), 101 deletions(-)
drivers/acpi/osl.c +0 -95
101 lines not on this page · raw message
include/acpi/platform/aclinux.h +0 -6
@@ -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)
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
Quoted 177 lines
-----Original Message-----
From: Lin, Ming M
Sent: Monday, May 11, 2009 1:14 AM
To: Alexey Starikovskiy
Cc: Moore, Robert; [email protected]
Subject: Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled wayHi, 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
Quoted 4 lines · Alexey Starikovskiy
Signed-off-by Alexey Starikovskiy <[email protected]>---
source/components/utilities/utcache.c | 99 +++++----------------------------
Review
Quoted 4 lines
1 files changed, 14 insertions(+), 85 deletions(-)(quoted diff) +0
-0
b/source/components/utilities/utcache.cQuoted 147 lines
index aabc0a2..d08d520 100644
source/components/utilities/utcache.c +14
-86@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
What bugs are you seeing? May I be of any help?
Regards,
Alex.
Quoted 194 lines · Robert
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
Quoted 178 lines
-----Original Message-----
From: Lin, Ming M
Sent: Monday, May 11, 2009 1:14 AM
To: Alexey Starikovskiy
Cc: Moore, Robert; [email protected]
Subject: Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled wayHi, 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
Quoted 5 lines · Alexey Starikovskiy
Signed-off-by Alexey Starikovskiy <[email protected]>---
source/components/utilities/utcache.c | 99 +++++----------------------------
Review
Quoted 5 lines
1 files changed, 14 insertions(+), 85 deletions(-)(quoted diff) +0
-0
b/source/components/utilities/utcache.cQuoted 143 lines
index aabc0a2..d08d520 100644
source/components/utilities/utcache.c +14
-85@@ -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 */ Quoted 5 lines
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Problems with deletion of the DdbHandle object type. I think we have it under control, thanks.
Quoted 214 lines
-----Original Message-----
From: Alexey Starikovskiy [mailto:[email protected]]
Sent: Tuesday, May 12, 2009 11:54 AM
To: Moore, Robert
Cc: Lin, Ming M; Alexey Starikovskiy; [email protected]
Subject: Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled wayWhat bugs are you seeing? May I be of any help?
Regards,
Alex.Quoted 1 line · Robert
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.
Quoted 30 lines
Bob
Quoted 25 lines
-----Original Message-----
From: Lin, Ming M
Sent: Monday, May 11, 2009 1:14 AM
To: Alexey Starikovskiy
Cc: Moore, Robert; [email protected]
Subject: Re: [PATCH 1/4] ACPICA: Remove use of caches in controlled wayHi, 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
Quoted 4 lines · Alexey Starikovskiy
Signed-off-by Alexey Starikovskiy <[email protected]>---
source/components/utilities/utcache.c | 99 +++++----------------------
Quoted 114 lines
Quoted 47 lines
Quoted 1 line
------
Review
Quoted 5 lines
1 files changed, 14 insertions(+), 85 deletions(-)(quoted diff) +0
-0
b/source/components/utilities/utcache.cQuoted 37 lines
index aabc0a2..d08d520 100644
source/components/utilities/utcache.c +0
-23@@ -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 */ Quoted 8 lines
source/components/utilities/utcache.c AcpiOsReleaseObject ( · line 327
Quoted 8 lines
source/components/utilities/utcache.c +0
-8- -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;
Quoted 58 lines
Quoted 58 lines
source/components/utilities/utcache.c +4
-37- 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++);Quoted 43 lines
Quoted 11 lines
source/components/utilities/utcache.c AcpiOsAcquireObject ( · line 350
Quoted 11 lines
source/components/utilities/utcache.c +3
-4#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;
Quoted 31 lines
Quoted 31 lines
source/components/utilities/utcache.c +7
-14+ }#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
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html