mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
a51324c430
Rework the way physical pages are set no-dat / dat: The old way is: - Rely on that all pages are initially marked "dat" - Allocate page tables for the kernel mapping - Enable dat - Walk the whole kernel mapping and set PG_arch_1 bit in all struct pages that belong to pages of kernel page tables - Walk all struct pages and test and clear the PG_arch_1 bit. If the bit is not set, set the page state to no-dat - For all subsequent page table allocations, set the page state to dat (remove the no-dat state) on allocation time Change this rather complex logic to a simpler approach: - Set the whole physical memory (all pages) to "no-dat" - Explicitly set those page table pages to "dat" which are part of the kernel image (e.g. swapper_pg_dir) - For all subsequent page table allocations, set the page state to dat (remove the no-dat state) on allocation time In result the code is simpler, and this also allows to get rid of one odd usage of the PG_arch_1 bit. Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
33 lines
678 B
C
33 lines
678 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright IBM Corp. 2008
|
|
*
|
|
* Guest page hinting for unused pages.
|
|
*
|
|
* Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
|
|
*/
|
|
|
|
#include <linux/mm.h>
|
|
#include <asm/page-states.h>
|
|
#include <asm/sections.h>
|
|
#include <asm/page.h>
|
|
|
|
int __bootdata_preserved(cmma_flag);
|
|
|
|
void arch_free_page(struct page *page, int order)
|
|
{
|
|
if (!cmma_flag)
|
|
return;
|
|
__set_page_unused(page_to_virt(page), 1UL << order);
|
|
}
|
|
|
|
void arch_alloc_page(struct page *page, int order)
|
|
{
|
|
if (!cmma_flag)
|
|
return;
|
|
if (cmma_flag < 2)
|
|
__set_page_stable_dat(page_to_virt(page), 1UL << order);
|
|
else
|
|
__set_page_stable_nodat(page_to_virt(page), 1UL << order);
|
|
}
|