mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 17:10:22 +00:00
- Fixed some locking problems during different processes access the same sections (dlls).
- Reduced the overhead in MmCreateImageSection if for a file the caching is initialized already. - Moved some values from SECTION_OBJECT to MM_IMAGE_SECTION_OBJECT. - Removed the lock from SECTION_OBJECT. svn path=/trunk/; revision=4982
This commit is contained in:
parent
8abf146aac
commit
9195641c84
5 changed files with 675 additions and 587 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: view.c,v 1.63 2003/06/16 19:16:32 hbirr Exp $
|
||||
/* $Id: view.c,v 1.64 2003/06/27 21:28:30 hbirr Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/cc/view.c
|
||||
|
@ -1077,6 +1077,39 @@ CcRosReleaseFileCache(PFILE_OBJECT FileObject)
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
CcTryToInitializeFileCache(PFILE_OBJECT FileObject)
|
||||
{
|
||||
PBCB Bcb;
|
||||
NTSTATUS Status;
|
||||
|
||||
ExAcquireFastMutex(&ViewLock);
|
||||
|
||||
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
|
||||
if (Bcb == NULL)
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FileObject->PrivateCacheMap == NULL)
|
||||
{
|
||||
FileObject->PrivateCacheMap = Bcb;
|
||||
Bcb->RefCount++;
|
||||
}
|
||||
if (Bcb->BcbRemoveListEntry.Flink != NULL)
|
||||
{
|
||||
RemoveEntryList(&Bcb->BcbRemoveListEntry);
|
||||
Bcb->BcbRemoveListEntry.Flink = NULL;
|
||||
}
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
ExReleaseFastMutex(&ViewLock);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
CcRosInitializeFileCache(PFILE_OBJECT FileObject,
|
||||
ULONG CacheSegmentSize)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __INCLUDE_INTERNAL_CC_H
|
||||
#define __INCLUDE_INTERNAL_CC_H
|
||||
/* $Id: cc.h,v 1.17 2003/01/11 15:21:09 hbirr Exp $ */
|
||||
/* $Id: cc.h,v 1.18 2003/06/27 21:28:30 hbirr Exp $ */
|
||||
#include <ddk/ntifs.h>
|
||||
|
||||
|
||||
|
@ -86,8 +86,8 @@ VOID CcInit(VOID);
|
|||
NTSTATUS
|
||||
CcRosUnmapCacheSegment(PBCB Bcb, ULONG FileOffset, BOOLEAN NowDirty);
|
||||
|
||||
NTSTATUS
|
||||
CcRosSuggestFreeCacheSegment(PBCB Bcb, ULONG FileOffset, BOOLEAN NowDirty);
|
||||
PCACHE_SEGMENT
|
||||
CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset);
|
||||
|
||||
NTSTATUS
|
||||
CcRosGetCacheSegmentChain(PBCB Bcb,
|
||||
|
@ -127,5 +127,8 @@ CcRosRequestCacheSegment (BCB* Bcb,
|
|||
PBOOLEAN UptoDate,
|
||||
CACHE_SEGMENT** CacheSeg);
|
||||
|
||||
NTSTATUS
|
||||
CcTryToInitializeFileCache(PFILE_OBJECT FileObject);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -79,7 +79,7 @@ typedef struct _MM_SECTION_SEGMENT
|
|||
ULONG Attributes;
|
||||
ULONG Length;
|
||||
ULONG RawLength;
|
||||
KMUTEX Lock;
|
||||
FAST_MUTEX Lock;
|
||||
ULONG ReferenceCount;
|
||||
SECTION_PAGE_DIRECTORY PageDirectory;
|
||||
ULONG Flags;
|
||||
|
@ -88,6 +88,22 @@ typedef struct _MM_SECTION_SEGMENT
|
|||
BOOLEAN WriteCopy;
|
||||
} MM_SECTION_SEGMENT, *PMM_SECTION_SEGMENT;
|
||||
|
||||
typedef struct _MM_IMAGE_SECTION_OBJECT
|
||||
{
|
||||
PVOID ImageBase;
|
||||
PVOID EntryPoint;
|
||||
ULONG StackReserve;
|
||||
ULONG StackCommit;
|
||||
ULONG Subsystem;
|
||||
ULONG MinorSubsystemVersion;
|
||||
ULONG MajorSubsystemVersion;
|
||||
ULONG ImageCharacteristics;
|
||||
USHORT Machine;
|
||||
BOOLEAN Executable;
|
||||
ULONG NrSegments;
|
||||
MM_SECTION_SEGMENT Segments[0];
|
||||
} MM_IMAGE_SECTION_OBJECT, *PMM_IMAGE_SECTION_OBJECT;
|
||||
|
||||
typedef struct _SECTION_OBJECT
|
||||
{
|
||||
CSHORT Type;
|
||||
|
@ -98,19 +114,11 @@ typedef struct _SECTION_OBJECT
|
|||
PFILE_OBJECT FileObject;
|
||||
LIST_ENTRY ViewListHead;
|
||||
KSPIN_LOCK ViewListLock;
|
||||
KMUTEX Lock;
|
||||
ULONG NrSegments;
|
||||
PMM_SECTION_SEGMENT Segments;
|
||||
PVOID ImageBase;
|
||||
PVOID EntryPoint;
|
||||
ULONG StackReserve;
|
||||
ULONG StackCommit;
|
||||
ULONG Subsystem;
|
||||
ULONG MinorSubsystemVersion;
|
||||
ULONG MajorSubsystemVersion;
|
||||
ULONG ImageCharacteristics;
|
||||
USHORT Machine;
|
||||
BOOLEAN Executable;
|
||||
union
|
||||
{
|
||||
PMM_IMAGE_SECTION_OBJECT ImageSection;
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
};
|
||||
} SECTION_OBJECT;
|
||||
|
||||
#ifndef __USE_W32API
|
||||
|
@ -444,11 +452,7 @@ MmMarkPageUnmapped(PHYSICAL_ADDRESS PhysicalAddress);
|
|||
VOID
|
||||
MmFreeSectionSegments(PFILE_OBJECT FileObject);
|
||||
|
||||
typedef struct _MM_IMAGE_SECTION_OBJECT
|
||||
{
|
||||
ULONG NrSegments;
|
||||
MM_SECTION_SEGMENT Segments[0];
|
||||
} MM_IMAGE_SECTION_OBJECT, *PMM_IMAGE_SECTION_OBJECT;
|
||||
|
||||
|
||||
VOID
|
||||
MmFreeVirtualMemory(struct _EPROCESS* Process, PMEMORY_AREA MemoryArea);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: rmap.c,v 1.18 2003/06/06 21:01:36 hbirr Exp $
|
||||
/* $Id: rmap.c,v 1.19 2003/06/27 21:28:30 hbirr Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -150,8 +150,14 @@ MmWritePagePhysicalAddress(PHYSICAL_ADDRESS PhysicalAddress)
|
|||
|
||||
if (PageOp->Thread != PsGetCurrentThread())
|
||||
{
|
||||
MmReleasePageOp(PageOp);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
Status = KeWaitForSingleObject(&PageOp->CompletionEvent,
|
||||
0,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
MmReleasePageOp(PageOp);
|
||||
if (Address < (PVOID)KERNEL_BASE)
|
||||
{
|
||||
ObDereferenceObject(Process);
|
||||
|
@ -298,8 +304,14 @@ MmPageOutPhysicalAddress(PHYSICAL_ADDRESS PhysicalAddress)
|
|||
Address, NULL, 0, MM_PAGEOP_PAGEOUT);
|
||||
if (PageOp->Thread != PsGetCurrentThread())
|
||||
{
|
||||
MmReleasePageOp(PageOp);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
Status = KeWaitForSingleObject(&PageOp->CompletionEvent,
|
||||
0,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
MmReleasePageOp(PageOp);
|
||||
if (Address < (PVOID)KERNEL_BASE)
|
||||
{
|
||||
ObDereferenceObject(Process);
|
||||
|
@ -443,6 +455,7 @@ MmDeleteAllRmaps(PHYSICAL_ADDRESS PhysicalAddress, PVOID Context,
|
|||
DPRINT1("MmDeleteAllRmaps: No rmaps.\n");
|
||||
KeBugCheck(0);
|
||||
}
|
||||
MmSetRmapListHeadPage(PhysicalAddress, NULL);
|
||||
while (current_entry != NULL)
|
||||
{
|
||||
previous_entry = current_entry;
|
||||
|
@ -454,7 +467,6 @@ MmDeleteAllRmaps(PHYSICAL_ADDRESS PhysicalAddress, PVOID Context,
|
|||
}
|
||||
ExFreeToNPagedLookasideList(&RmapLookasideList, previous_entry);
|
||||
}
|
||||
MmSetRmapListHeadPage(PhysicalAddress, NULL);
|
||||
ExReleaseFastMutex(&RmapListLock);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue