Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3787332pxv; Mon, 26 Jul 2021 12:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBBh5VhfS0y+8CcLATr4YpehfTXAj/uyCGBOKEISkbtAfRX5LbyGyAGaph5jqQPCq2gc53 X-Received: by 2002:a05:6638:3048:: with SMTP id u8mr17678725jak.91.1627326232537; Mon, 26 Jul 2021 12:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627326232; cv=none; d=google.com; s=arc-20160816; b=sNU5JKLLXH3t3sNryhx97NzjUabYXs8vsqAfRxOUQxRfCOF/uRb1uV12lafGOq8HzG 5fxUuuB7KjvTOf6HIGy3rWXrTD7UBNIiOYyiTBZQt55+zq/qKt93F6j2Naoj9UEVACTH Dppukp4nt0wH8GDYCh6lT1HXvowG5JLp/TIZvqV6rHSyJje7pGJZQt9HEqXCkycC27Ek GJMDeVXCsBb+aIdnxWTx5sOlqIJMeSxJnxJZA2hJAoUXY4vqE9mhk5domxf8+LjaIGu/ sxiJjRHgmiyp5dybtMezM8PM+GvBJG3Zx3xKxv5t80YtYeriJfAB9KmB/MQOXeO5AhAL 41jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from:dkim-signature; bh=bJzD/4dookOedoazAyDMd9sbQFHTEV2nMBxfajFsEmQ=; b=gSEGKkkayxdQhpAI7ZitJJDldQdGENDFxcg3CYn3hozGNi20mjjwC8Yj8DPTd93ob4 plAP+MxYfP8Q/cQwFhBfQN7dgGsaouYrdLbVdIGM+ke2YO/fEtkphw7PCRpBSb+Tn+sh 2pW9bBXYdlV8PUp9gUTdlvM0s2mRKu58mio52oNfWtlxWJnGZWhmchXpqNPf85aYZMwR RWbPJSDvvnKekKvCX7lgWQ+fdsAAu8WRe2tUqh6RgkEBJhaiZ52ONox5u5Fz9TRFt+dF 5eI3NtE3vtT4aPCT29kXSvAc5dQWRj0FTBiuQHkdKtwM5uH4VbHN8wpV4Fw5W+0iQuQ3 r6ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b="U8FCe/K+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si633435jaq.116.2021.07.26.12.03.40; Mon, 26 Jul 2021 12:03:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b="U8FCe/K+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233195AbhGZSVZ (ORCPT + 99 others); Mon, 26 Jul 2021 14:21:25 -0400 Received: from relay.sw.ru ([185.231.240.75]:55438 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233132AbhGZSVO (ORCPT ); Mon, 26 Jul 2021 14:21:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Content-Type:MIME-Version:Date:Message-ID:Subject :From; bh=bJzD/4dookOedoazAyDMd9sbQFHTEV2nMBxfajFsEmQ=; b=U8FCe/K+e1NUX3XwBF8 D3xuQ39kF9ixkCs5J8uqlRtKmHoUhEfhmJZvLajoTzbfaoW7xO+0cmuQHIkPHXlzCRDD8gmubVcB3 5edHMkVIFhI6CD8q3CVmYj6zDB+hRGreBSU43kJDMo3M/Y0VW1ot1dgQZ+nFOpww/kZ62kKqL+w=; Received: from [10.93.0.56] by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1m85rC-005JWu-4U; Mon, 26 Jul 2021 22:01:42 +0300 From: Vasily Averin Subject: [PATCH v6 14/16] memcg: enable accounting for posix_timers_cache slab To: Andrew Morton Cc: cgroups@vger.kernel.org, Michal Hocko , Shakeel Butt , Johannes Weiner , Vladimir Davydov , Roman Gushchin , Thomas Gleixner , linux-kernel@vger.kernel.org References: <9bf9d9bd-03b1-2adb-17b4-5d59a86a9394@virtuozzo.com> Message-ID: <55a29076-96a0-c19e-2932-c8a49d61bde1@virtuozzo.com> Date: Mon, 26 Jul 2021 22:01:41 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A program may create multiple interval timers using timer_create(). For each timer the kernel preallocates a "queued real-time signal", Consequently, the number of timers is limited by the RLIMIT_SIGPENDING resource limit. The allocated object is quite small, ~250 bytes, but even the default signal limits allow to consume up to 100 megabytes per user. It makes sense to account for them to limit the host's memory consumption from inside the memcg-limited container. Signed-off-by: Vasily Averin Reviewed-by: Thomas Gleixner --- kernel/time/posix-timers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index dd5697d..7363f81 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -273,8 +273,8 @@ static int posix_get_hrtimer_res(clockid_t which_clock, struct timespec64 *tp) static __init int init_posix_timers(void) { posix_timers_cache = kmem_cache_create("posix_timers_cache", - sizeof (struct k_itimer), 0, SLAB_PANIC, - NULL); + sizeof(struct k_itimer), 0, + SLAB_PANIC | SLAB_ACCOUNT, NULL); return 0; } __initcall(init_posix_timers); -- 1.8.3.1