Skip to content

Commit aa18e0e

Browse files
davidhildenbrandhcahca
authored andcommitted
s390/vmemmap: take the vmem_mutex when populating/freeing
Let's synchronize all accesses to the 1:1 and vmemmap mappings. This will be especially relevant when wanting to cleanup empty page tables that could be shared by both. Avoid races when removing tables that might be just about to get reused. Cc: Vasily Gorbik <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Gerald Schaefer <[email protected]> Signed-off-by: David Hildenbrand <[email protected]> Message-Id: <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent c00f05a commit aa18e0e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/s390/mm/vmem.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,17 +334,21 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
334334
{
335335
int ret;
336336

337+
mutex_lock(&vmem_mutex);
337338
/* We don't care about the node, just use NUMA_NO_NODE on allocations */
338339
ret = add_pagetable(start, end, false);
339340
if (ret)
340341
remove_pagetable(start, end, false);
342+
mutex_unlock(&vmem_mutex);
341343
return ret;
342344
}
343345

344346
void vmemmap_free(unsigned long start, unsigned long end,
345347
struct vmem_altmap *altmap)
346348
{
349+
mutex_lock(&vmem_mutex);
347350
remove_pagetable(start, end, false);
351+
mutex_unlock(&vmem_mutex);
348352
}
349353

350354
void vmem_remove_mapping(unsigned long start, unsigned long size)

0 commit comments

Comments
 (0)