summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/sgx/main.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2021-11-19 09:31:55 +0100
committerIngo Molnar <mingo@kernel.org>2021-11-19 09:31:55 +0100
commit5c16f7ee03c011b0c6cd4c6deccaf0b269d054b2 (patch)
tree486398a347143edc22d2f3f042dff21cafd31d74 /arch/x86/kernel/cpu/sgx/main.c
parent379e4de9e140850cf699dd390f21ea4b923c955d (diff)
parentac5d272a0ad0419f52e08c91953356e32b075af7 (diff)
downloadlinux-5c16f7ee03c011b0c6cd4c6deccaf0b269d054b2.tar.gz
linux-5c16f7ee03c011b0c6cd4c6deccaf0b269d054b2.tar.bz2
linux-5c16f7ee03c011b0c6cd4c6deccaf0b269d054b2.zip
Merge branch 'x86/urgent' into x86/sgx, to resolve conflict
Conflicts: arch/x86/kernel/cpu/sgx/main.c Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu/sgx/main.c')
-rw-r--r--arch/x86/kernel/cpu/sgx/main.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
index 231c494dfd40..6036328de255 100644
--- a/arch/x86/kernel/cpu/sgx/main.c
+++ b/arch/x86/kernel/cpu/sgx/main.c
@@ -29,8 +29,7 @@ static DEFINE_XARRAY(sgx_epc_address_space);
static LIST_HEAD(sgx_active_page_list);
static DEFINE_SPINLOCK(sgx_reclaimer_lock);
-/* The free page list lock protected variables prepend the lock. */
-static unsigned long sgx_nr_free_pages;
+static atomic_long_t sgx_nr_free_pages = ATOMIC_LONG_INIT(0);
/* Nodes with one or more EPC sections. */
static nodemask_t sgx_numa_mask;
@@ -422,14 +421,15 @@ skip:
spin_lock(&node->lock);
list_add_tail(&epc_page->list, &node->free_page_list);
- sgx_nr_free_pages++;
spin_unlock(&node->lock);
+ atomic_long_inc(&sgx_nr_free_pages);
}
}
static bool sgx_should_reclaim(unsigned long watermark)
{
- return sgx_nr_free_pages < watermark && !list_empty(&sgx_active_page_list);
+ return atomic_long_read(&sgx_nr_free_pages) < watermark &&
+ !list_empty(&sgx_active_page_list);
}
static int ksgxd(void *p)
@@ -490,10 +490,10 @@ static struct sgx_epc_page *__sgx_alloc_epc_page_from_node(int nid)
page = list_first_entry(&node->free_page_list, struct sgx_epc_page, list);
list_del_init(&page->list);
- sgx_nr_free_pages--;
page->flags = 0;
spin_unlock(&node->lock);
+ atomic_long_dec(&sgx_nr_free_pages);
return page;
}
@@ -649,10 +649,10 @@ void sgx_free_epc_page(struct sgx_epc_page *page)
list_add(&page->list, &node->sgx_poison_page_list);
else
list_add_tail(&page->list, &node->free_page_list);
- sgx_nr_free_pages++;
page->flags = SGX_EPC_PAGE_IS_FREE;
spin_unlock(&node->lock);
+ atomic_long_inc(&sgx_nr_free_pages);
}
static bool __init sgx_setup_epc_section(u64 phys_addr, u64 size,