contigmalloc uses up all free memory.

From: Bennett, Ciunas <ciunas.bennett_at_intel.com>
Date: Wed, 17 Oct 2018 14:06:17 +0000
Hello,

I have encountered an issue with a kernel application that I have written,
the application allocates  and deallocates contiguous memory using contigmalloc() and contigfree().
The application will fail after a period of time because there is not enough free contiguous memory left.
There could be an issue with the freeing of memory when using the contigfree() function.

I have attached a simplified version of the application.
The resulting kernel module just allocates contiguous memory and then frees the memory using contigfree();
This allocation is done in a loop and the attached  src code triggers the issue.

After a period of time when running the application multiple times, the kernel reports
that there is no available memory and fails with allocation.

I can see that the amount of free memory is decreasing in correlation to how many

times I run the application by using DDB and printing out freepages using "show freepages"


I run the application in a loop using a shell script where I kldload then kldunload multiple times (script runs up to 1000000)

The application can take 20 to over 60 minutes to trigger the issue and run out of memory but can take longer also.

I am running the application on ->
FreeBSD 12.0-ALPHA9 also tested on 11.2
VM with 2 Gb of ram.
Allocating one cpu core.
Running on an Intel(R) Xeon(R) CPU E5-2658 v2 _at_ 2.40GH using Ubuntu 16.04 host.

I have attached the test kernel application and a Makefile.

Thanks,
Ciunas.
--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

Received on Wed Oct 17 2018 - 12:06:28 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:18 UTC