public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [BUG?] memory allocation profiling: the counters are not non-decreasing.
@ 2024-06-05 12:37 David Wang
  2024-06-05 20:00 ` Suren Baghdasaryan
  0 siblings, 1 reply; 3+ messages in thread
From: David Wang @ 2024-06-05 12:37 UTC (permalink / raw)
  To: kent.overstreet, surenb, keescook; +Cc: linux-kernel

Hi,
I was playing with this new feature of memory allocation profiling, when I plot the data, grouped by caller's source dir, 
I noticed that the counters are not non-decreasing.
If I understand this feature correctly, all counters should be non-decreasing, right?
Or is there some TTL for stale items?

Following is a simpler script demonstrating my sayings

	$ for i in {1..100}; do sudo cat /proc/allocinfo | grep " mm\/" | awk '{s+=$2}END{print s}'; sleep 10; done
	1194453
	1196935
	1198957
	1199716
	1200770
	1190795  <--- decrease here
	1192702
	1193070
	1193812
	1195069
	1196491
	...

FYI
David


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG?] memory allocation profiling: the counters are not non-decreasing.
  2024-06-05 12:37 [BUG?] memory allocation profiling: the counters are not non-decreasing David Wang
@ 2024-06-05 20:00 ` Suren Baghdasaryan
  2024-06-06  3:42   ` David Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Suren Baghdasaryan @ 2024-06-05 20:00 UTC (permalink / raw)
  To: David Wang; +Cc: kent.overstreet, keescook, linux-kernel

On Wed, Jun 5, 2024 at 5:37 AM David Wang <00107082@163.com> wrote:
>
> Hi,
> I was playing with this new feature of memory allocation profiling, when I plot the data, grouped by caller's source dir,
> I noticed that the counters are not non-decreasing.
> If I understand this feature correctly, all counters should be non-decreasing, right?
> Or is there some TTL for stale items?

Hi David,
Counters can decrease once an allocation is freed.
Thanks,
Suren.

>
> Following is a simpler script demonstrating my sayings
>
>         $ for i in {1..100}; do sudo cat /proc/allocinfo | grep " mm\/" | awk '{s+=$2}END{print s}'; sleep 10; done
>         1194453
>         1196935
>         1198957
>         1199716
>         1200770
>         1190795  <--- decrease here
>         1192702
>         1193070
>         1193812
>         1195069
>         1196491
>         ...
>
> FYI
> David
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG?] memory allocation profiling: the counters are not non-decreasing.
  2024-06-05 20:00 ` Suren Baghdasaryan
@ 2024-06-06  3:42   ` David Wang
  0 siblings, 0 replies; 3+ messages in thread
From: David Wang @ 2024-06-06  3:42 UTC (permalink / raw)
  To: Suren Baghdasaryan; +Cc: kent.overstreet, keescook, linux-kernel

At 2024-06-06 04:00:17, "Suren Baghdasaryan" <surenb@google.com> wrote:
>On Wed, Jun 5, 2024 at 5:37 AM David Wang <00107082@163.com> wrote:
>>
>> Hi,
>> I was playing with this new feature of memory allocation profiling, when I plot the data, grouped by caller's source dir,
>> I noticed that the counters are not non-decreasing.
>> If I understand this feature correctly, all counters should be non-decreasing, right?
>> Or is there some TTL for stale items?
>
>Hi David,
>Counters can decrease once an allocation is freed.
>Thanks,
>Suren.
>

Hi  Suren,

Thanks for the quick response. 
I guess I misunderstood this feature, no wonder I saw several "zero" values.

If "freed" memory is also tracked accurately, I feel this would be a very powerful feature!

Thx~
David

>>
>> Following is a simpler script demonstrating my sayings
>>
>>         $ for i in {1..100}; do sudo cat /proc/allocinfo | grep " mm\/" | awk '{s+=$2}END{print s}'; sleep 10; done
>>         1194453
>>         1196935
>>         1198957
>>         1199716
>>         1200770
>>         1190795  <--- decrease here
>>         1192702
>>         1193070
>>         1193812
>>         1195069
>>         1196491
>>         ...
>>
>> FYI
>> David
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-06  3:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05 12:37 [BUG?] memory allocation profiling: the counters are not non-decreasing David Wang
2024-06-05 20:00 ` Suren Baghdasaryan
2024-06-06  3:42   ` David Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox