mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +03:00
Prevent zevent list from consuming all of kernel memory
There are a couple changes included here. The first is to introduce a cap on the size the ZED will grow the zevent list to. One million entries is more than enough for most use cases, and if you are overflowing that value, the problem needs to be addressed another way. The value is also tunable, for those who want the limit to be higher or lower. The other change is to add a kernel module parameter that allows snapshot creation/deletion to be exempted from the history logging; for most workloads, having these things logged is valuable, but for some workloads it produces large quantities of log spam and isn't especially helpful. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Paul Dagnelie <pcd@delphix.com> Issue #13374 Closes #13753
This commit is contained in:
+15
-1
@@ -48,6 +48,7 @@ zed_conf_init(struct zed_conf *zcp)
|
||||
zcp->zevent_fd = -1; /* opened in zed_event_init() */
|
||||
|
||||
zcp->max_jobs = 16;
|
||||
zcp->max_zevent_buf_len = 1 << 20;
|
||||
|
||||
if (!(zcp->pid_file = strdup(ZED_PID_FILE)) ||
|
||||
!(zcp->zedlet_dir = strdup(ZED_ZEDLET_DIR)) ||
|
||||
@@ -141,6 +142,8 @@ _zed_conf_display_help(const char *prog, boolean_t got_err)
|
||||
.v = ZED_STATE_FILE },
|
||||
{ .o = "-j JOBS", .d = "Start at most JOBS at once.",
|
||||
.v = "16" },
|
||||
{ .o = "-b LEN", .d = "Cap kernel event buffer at LEN entries.",
|
||||
.v = "1048576" },
|
||||
{},
|
||||
};
|
||||
|
||||
@@ -230,7 +233,7 @@ _zed_conf_parse_path(char **resultp, const char *path)
|
||||
void
|
||||
zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
|
||||
{
|
||||
const char * const opts = ":hLVd:p:P:s:vfFMZIj:";
|
||||
const char * const opts = ":hLVd:p:P:s:vfFMZIj:b:";
|
||||
int opt;
|
||||
unsigned long raw;
|
||||
|
||||
@@ -291,6 +294,17 @@ zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
|
||||
zcp->max_jobs = raw;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
errno = 0;
|
||||
raw = strtoul(optarg, NULL, 0);
|
||||
if (errno == ERANGE || raw > INT32_MAX) {
|
||||
zed_log_die("%lu is too large", raw);
|
||||
} if (raw == 0) {
|
||||
zcp->max_zevent_buf_len = INT32_MAX;
|
||||
} else {
|
||||
zcp->max_zevent_buf_len = raw;
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
if (optopt == '?')
|
||||
|
||||
Reference in New Issue
Block a user