From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbcFNPvh (ORCPT ); Tue, 14 Jun 2016 11:51:37 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35991 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751239AbcFNPvf (ORCPT ); Tue, 14 Jun 2016 11:51:35 -0400 Subject: Re: [RFC 14/18] limits: track RLIMIT_SIGPENDING actual max To: Oleg Nesterov References: <1465847065-3577-1-git-send-email-toiwoton@gmail.com> <1465847065-3577-15-git-send-email-toiwoton@gmail.com> <20160614145019.GA32429@redhat.com> Cc: linux-kernel@vger.kernel.org, Andrew Morton , Ingo Molnar , "Amanieu d'Antras" , Stas Sergeev , Dave Hansen , Wang Xiaoqiang , Helge Deller , Sasha Levin From: Topi Miettinen Openpgp: id=A0F2EB0D8452DA908BEC8E911CF9ADDBD610E936 Message-ID: Date: Tue, 14 Jun 2016 15:51:32 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160614145019.GA32429@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/14/16 14:50, Oleg Nesterov wrote: > On 06/13, Topi Miettinen wrote: >> >> Track maximum number of pending signals, presented in /proc/self/limits. >> >> Signed-off-by: Topi Miettinen >> --- >> kernel/signal.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/kernel/signal.c b/kernel/signal.c >> index 96e9bc4..c8fbccd 100644 >> --- a/kernel/signal.c >> +++ b/kernel/signal.c >> @@ -387,6 +387,8 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi >> INIT_LIST_HEAD(&q->list); >> q->flags = 0; >> q->user = user; >> + /* XXX resource limits apply per task, not per user */ >> + bump_rlimit(RLIMIT_SIGPENDING, atomic_read(&user->sigpending)); > > Well, I have to admit that I too dislike the very idea of these changes... > > But this particular patch looks wrong in any case. I wasn't cc'ed on the > previous patches which add bump_rlimit(), but I have found > > "[RFC 05/18] limits: track and present RLIMIT_NOFILE actual max" > http://marc.info/?l=linux-fsdevel&m=146584742331072&w=2 > I used git send-email --cc-cmd=scripts/get_maintainer.pl to generate the CC lists. Is there a better way? > and bump_rlimit() changes current->signal->rlim_curmax, while in this case > you need to bump t->signal->rlim_curmax. > > Oleg. > Yes, I also added task_bump_rlimit() which would be better choice here. -Topi