Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp91274pxf; Wed, 10 Mar 2021 01:00:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJz99Ye7sDp8VFE4h10z3YGOosuaipCKK2jUD2prgOjswHYSGhjhMBgZZPgKa1Z7p/cBvVWn X-Received: by 2002:a17:907:77d4:: with SMTP id kz20mr2516429ejc.93.1615366842532; Wed, 10 Mar 2021 01:00:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615366842; cv=none; d=google.com; s=arc-20160816; b=MeDplBeixPhSb4vhSafQMPsqQSsPV9aJtNDx1rmnnvtpufa6NPAVT5ArMDZlFdpYYP dLr70TsM5hWEhqz4N1gy8SjLTM96MmM+70/9Y6SNZbxOgm8Cb29YVMaziFOvxV5lZUYI hXIGqRyml2QFhMvLyAx2cjKeNW22PUgW4kcMp8aMc5Mm1mlRY1w//nF7plR1/NTUziyn i0nF0h1NmlQoTzGIVt+/aBmuTUve5YJ0YOpJT9Vvn8l82sGiucahZw3Teg1xDjQoD4UG jU2UYErv/ehJkGrPphKncK/jcOkTuOJdk17cpqP/N1IZzoFaYJOT433bYZc6MwRJG124 dJeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=7Prcn4FBWkHEBWzQEVl+zK5TjWq1HiyVjVL+CC+4j9Y=; b=IEy8lLsW+k9GFzTG8zeSXpFTi6VCdCnZaC0z5eqTEPSDUDRXZ7I4RmNt6Ke6B4nNBK AxUqZ90DZN91fqUeQQpJm8qJevW5NWImHRjhaJ0HCEEMPbenizNX6wn/6ZzA/toaJOuW g4lkFuzClPKQGQcC0RWpZsokU6/Yn05J2MDIV83z6Qo2dYY1NrVwdUOvF5P7kGVnU48T vo52D88n3iAHnSLPjsSfCBAcOAAWacSdNa4n7ODOq0tohAIZpoySmmIETHmRERqqwALh dAYJT8YNa4epmr1JoqHivTqVeJRlh1NQ7kcfSI4ZEK23PBU0fwWP6WMYMbFJgD0tGaec saig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jy0h0pKi; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si10945753ejf.297.2021.03.10.01.00.18; Wed, 10 Mar 2021 01:00:42 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=jy0h0pKi; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231899AbhCJI5z (ORCPT + 99 others); Wed, 10 Mar 2021 03:57:55 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:58628 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231492AbhCJI5b (ORCPT ); Wed, 10 Mar 2021 03:57:31 -0500 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1615366650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7Prcn4FBWkHEBWzQEVl+zK5TjWq1HiyVjVL+CC+4j9Y=; b=jy0h0pKixcREetU90jQ8vU2+IzUoXRINA6fqjcZJSIFT/uNy4y9VP5fA170ln1VhLtfcjX jq2uDZGbRbTuZ3vXW4RP44CW5/cvDuy49hB7nJGxjSsovfqgDDKEO68inqUqHL5+hu+U57 F0S5M0+smxWd5lnieFc7ChDtCscJxtwNsoXid4q4oIf9mIZkUkluKR+V4+wdw9NNoqymOZ DsKgZdunabnxB7by6omPDBVFhA1GkEOY9BzpZDBbGYfAb/iO9CtJnuNjQ6cwW+yGZ+iyQ3 FkKfp/groD4gm1EJG7nM5HYNwFsyD6G3Y69dfZFgGrZroAkPcTvEDYtqQcYjVQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1615366650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7Prcn4FBWkHEBWzQEVl+zK5TjWq1HiyVjVL+CC+4j9Y=; b=SUIj8OjAPQmktIrPdGPWGmuXNbBC3kR8vvKcymTyQtvgW4NnhY2wHdp/Jn2NwpDZHube9F J0C80ZFxyLW0q9BQ== To: Oleg Nesterov Cc: Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Matt Fleming Subject: Re: [PATCH] signal: Allow RT tasks to cache one sigqueue struct In-Reply-To: References: Date: Wed, 10 Mar 2021 09:57:30 +0100 Message-ID: <87v99z4c91.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 09 2021 at 13:01, Thomas Gleixner wrote: > On Fri, Mar 05 2021 at 11:57, Oleg Nesterov wrote: >> On 03/04, Thomas Gleixner wrote: >>> On Wed, Mar 03 2021 at 16:37, Oleg Nesterov wrote: >>> >> +static bool sigqueue_add_cache(struct task_struct *t, struct sigqueue *q) >>> >> +{ >>> >> + if (!t->sigqueue_cache && cmpxchg(&t->sigqueue_cache, NULL, q) == NULL) >>> >> + return true; >>> >> + return false; >>> >> +} >>> > >>> > Do we really need cmpxchg? It seems they are always called with >>> > spinlock held. >>> >>> With which spinlock held? >>> >>> __send_signal() <- sighand::siglock held >>> __sigqueue_alloc() >>> >>> alloc_posix_timer() >>> sigqueue_alloc() <- No lock held >>> __sigqueue_alloc() >> >> In the last case "fromslab" is true, sigqueue_from_cache() won't be called. >> >>> and on the free side we have a bunch of callers which do not hold >>> sighand::siglock either. >> >> Where? Bah. I confused myself. Let me start over with that. Thanks, tglx