forked from netdata/netdata
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not use mmap when the mmap limit is too low (netdata#19714)
- Loading branch information
Showing
5 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#include "mmap_limit.h" | ||
#include "libnetdata/libnetdata.h" | ||
|
||
unsigned long long os_mmap_limit(void) { | ||
static unsigned long long cached_limit = 0; | ||
|
||
if (cached_limit) | ||
return cached_limit; | ||
|
||
#if defined(OS_LINUX) | ||
if(read_single_number_file("/proc/sys/vm/max_map_count", &cached_limit) != 0) | ||
cached_limit = 65536; | ||
#else | ||
// For other operating systems, assume no limit. | ||
cached_limit = UINT32_MAX; | ||
#endif | ||
|
||
return cached_limit; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef NETDATA_MMAP_LIMIT_H | ||
#define NETDATA_MMAP_LIMIT_H | ||
|
||
#include "libnetdata/common.h" | ||
|
||
unsigned long long os_mmap_limit(void); | ||
|
||
#endif //NETDATA_MMAP_LIMIT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters