Skip to content

Commit

Permalink
x86/fpu: Don't create a kmem fpu-state cache if it already exists
Browse files Browse the repository at this point in the history
We were accidentally creating the same kmem cache for every CPU that
called fpu_cache_init. Oopsie.

Signed-off-by: Pedro Falcato <[email protected]>
  • Loading branch information
heatd committed May 12, 2024
1 parent bde2a0b commit 020772f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/arch/x86_64/fpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ static slab_cache *fpu_cache = nullptr;
*/
void fpu_init_cache()
{
if (fpu_cache)
return;
fpu_cache = kmem_cache_create("fpu-state", fpu_area_size, fpu_area_alignment, 0, nullptr);
if (!fpu_cache)
panic("Out of memory allocating fpu state");
Expand Down

0 comments on commit 020772f

Please sign in to comment.