mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
UPSTREAM: KVM: arm64: Use less bits for hyp_page refcount
The hyp_page refcount is currently encoded on 4 bytes even though we
never need to count that many objects in a page. Make it 2 bytes to save
some space in the vmemmap.
As overflows are more likely to happen as well, make sure to catch those
with a BUG in the increment function.
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210608114518.748712-8-qperret@google.com
(cherry picked from commit 6929586d8e)
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 192636784
Change-Id: I1e36b015fc65b45b811a886607e9aa3bce873e27
This commit is contained in:
committed by
Will Deacon
parent
05d7d55b07
commit
ce9bce48a9
@@ -8,7 +8,7 @@
|
||||
#include <linux/types.h>
|
||||
|
||||
struct hyp_page {
|
||||
unsigned int refcount;
|
||||
unsigned short refcount;
|
||||
unsigned short order;
|
||||
};
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@ static struct hyp_page *__hyp_extract_page(struct hyp_pool *pool,
|
||||
|
||||
static inline void hyp_page_ref_inc(struct hyp_page *p)
|
||||
{
|
||||
BUG_ON(p->refcount == USHRT_MAX);
|
||||
p->refcount++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user