Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Oct 2018 09:46:59 +0000
From:      "Bennett, Ciunas" <ciunas.bennett@intel.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        "freebsd-stable@freebsd.org" <freebsd-stable@freebsd.org>
Subject:   RE: Possible memory leak in the kernel (contigmalloc)
Message-ID:  <770FD3608C9E864796AB46CB37B561B1BE0B4096@irsmsx105.ger.corp.intel.com>
In-Reply-To: <20181026201230.GV5335@kib.kiev.ua>
References:  <770FD3608C9E864796AB46CB37B561B1BDFCF0CD@IRSMSX101.ger.corp.intel.com> <20181026201230.GV5335@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

I was debugging the issue by viewing the free ques "sysctl vm.phys_free" an=
d also using "show page" in ddb.
The inactive memory is never being released back into the free que. =

I thought that when inactive memory reaches a certain threshold that the ke=
rnel will start reclaiming and move it to the free list?
In my program this is not happening, the program uses free memory (contigma=
lloc), and then it is put into the inactive que (contiigfree) when the prog=
ram frees it.
This inactive memory is never released by the kernel, and the inactive que =
grows until all the memory is in this que.
I  have attached a xml sheet that shows the memory usage in the system.

Ciunas.

-----Original Message-----
From: Konstantin Belousov [mailto:kostikbel@gmail.com] =

Sent: Friday, October 26, 2018 9:13 PM
To: Bennett, Ciunas <ciunas.bennett@intel.com>
Cc: freebsd-stable@freebsd.org
Subject: Re: Possible memory leak in the kernel (contigmalloc)

On Wed, Oct 24, 2018 at 04:27:52PM +0000, Bennett, Ciunas wrote:
> Hello,
> =

> I have encountered an issue with a kernel application that I have =

> written, the issue might be caused by a memory leak in the kernel.
> 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.
>

It is unlikely that there is an issue with a leak, but I would be not surpr=
ised if your allocation/free pattern would cause fragmentation on free list=
s that results in contigmalloc(9) failures after.

Look at the vmstat -z/vmstat -m output to see uma and malloc stats.
More interesting for your case can be the output from
	sysctl vm.phys_free
which provides information about the free queues and order of free pages on=
 them.
--------------------------------------------------------------
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 s=
ole
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?770FD3608C9E864796AB46CB37B561B1BE0B4096>