From 6827bd2a22b78aa05e20d6460412fc7b2d738929 Mon Sep 17 00:00:00 2001 From: kenneth Date: Wed, 27 Oct 2021 15:35:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DOsVmPhysFreeListAdd?= =?UTF-8?q?=E5=92=8COsVmPhysFreeListAddUnsafe=E5=87=BD=E6=95=B0=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除OsVmPhysFreeListAdd/OsVmPhysFreeListAddUnsafe、OsVmPhysFreeListDel/OsVmPhysFreeListDelUnsafe两对内部函数内容重复的部分。 close #I4FL95 Signed-off-by: kenneth --- kernel/base/vm/los_vm_phys.c | 39 +++--------------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/kernel/base/vm/los_vm_phys.c b/kernel/base/vm/los_vm_phys.c index d1e006d3..6bdcfdd0 100644 --- a/kernel/base/vm/los_vm_phys.c +++ b/kernel/base/vm/los_vm_phys.c @@ -157,23 +157,6 @@ VOID OsVmPhysInit(VOID) } } -STATIC VOID OsVmPhysFreeListAdd(LosVmPage *page, UINT8 order) -{ - struct VmPhysSeg *seg = NULL; - struct VmFreeList *list = NULL; - - if (page->segID >= VM_PHYS_SEG_MAX) { - LOS_Panic("The page segment id(%d) is invalid\n", page->segID); - } - - page->order = order; - seg = &g_vmPhysSeg[page->segID]; - - list = &seg->freeList[order]; - LOS_ListTailInsert(&list->node, &page->node); - list->listCnt++; -} - STATIC VOID OsVmPhysFreeListAddUnsafe(LosVmPage *page, UINT8 order) { struct VmPhysSeg *seg = NULL; @@ -207,22 +190,6 @@ STATIC VOID OsVmPhysFreeListDelUnsafe(LosVmPage *page) page->order = VM_LIST_ORDER_MAX; } -STATIC VOID OsVmPhysFreeListDel(LosVmPage *page) -{ - struct VmPhysSeg *seg = NULL; - struct VmFreeList *list = NULL; - - if ((page->segID >= VM_PHYS_SEG_MAX) || (page->order >= VM_LIST_ORDER_MAX)) { - LOS_Panic("The page segment id(%u) or order(%u) is invalid\n", page->segID, page->order); - } - - seg = &g_vmPhysSeg[page->segID]; - list = &seg->freeList[page->order]; - list->listCnt--; - LOS_ListDelete(&page->node); - page->order = VM_LIST_ORDER_MAX; -} - STATIC VOID OsVmPhysPagesSpiltUnsafe(LosVmPage *page, UINT8 oldOrder, UINT8 newOrder) { UINT32 order; @@ -376,14 +343,14 @@ VOID OsVmPhysPagesFree(LosVmPage *page, UINT8 order) if ((buddyPage == NULL) || (buddyPage->order != order)) { break; } - OsVmPhysFreeListDel(buddyPage); + OsVmPhysFreeListDelUnsafe(buddyPage); order++; pa &= ~(VM_ORDER_TO_PHYS(order) - 1); page = OsVmPhysToPage(pa, page->segID); } while (order < VM_LIST_ORDER_MAX - 1); } - OsVmPhysFreeListAdd(page, order); + OsVmPhysFreeListAddUnsafe(page, order); } VOID OsVmPhysPagesFreeContiguous(LosVmPage *page, size_t nPages) @@ -553,7 +520,7 @@ VOID OsPhysSharePageCopy(PADDR_T oldPaddr, PADDR_T *newPaddr, LosVmPage *newPage oldPage = LOS_VmPageGet(oldPaddr); if (oldPage == NULL) { - VM_ERR("invalid paddr %p", oldPaddr); + VM_ERR("invalid oldPaddr %p", oldPaddr); return; }