Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp630258ima; Wed, 24 Oct 2018 06:54:55 -0700 (PDT) X-Google-Smtp-Source: AJdET5dwGQxP9lV0Wsrh1gYKC1KTpq3TT/gLPfC1JqP2PTeUxc355TB7XCnUBdUQRRE0bLeXv/fp X-Received: by 2002:a62:d405:: with SMTP id a5-v6mr2738635pfh.174.1540389295327; Wed, 24 Oct 2018 06:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540389295; cv=none; d=google.com; s=arc-20160816; b=bqYYi6XCx7VNW5sEEP6e4Iir6Rv2fFjdGfTLDpOOp4lWQNMat6zSTbDKcOFuoGa09y 4PGEEN+RkOLJdL0jGUi+Re7ENzL2edk0VWeJSrs3aFj75Vbu6h1CaQXUeS6WeaNMKWng BsY7zu/cD2n7J+YFDydmI4vkdmD/t2fbfnTyLwvJ53OpOrr0E0jZNR5pr2hI7pg7DB6b NiiL0kTKh8MuRk2pTqb79eR6sfvlZ493XiX69ftdRgAIm37twts8sFK9ZEdXUlv+LfxJ z+Z0Oo3g8nG+2ZMUbDsoDmWMuZ7bemmXB245vF5ofR7vTxjPo/9XOv5uj1tp2T9hUMx1 rPKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=dTagJcFEO8lblPubMJkm3fy14TdI3Gds/cA6uoGBpYY=; b=JeVOmCAAHYx74GwUg0PfdMzMoH7XgUiwt9S7PyAUVe/laFGEwNjM0ulxeEq0B2naiU WA27opbTRqU/d1ks0J6bZEnt96u7pBROGSf4MR2GXD4VJyKhiAndq2E7Rq5HbmyS6YiN AtHWEc0zmdnaHeVaxiq1sqQZlMpQ03MnKjrV3YJaRYOAToOc1WGajy6O4doyvI47cYca We3m9cpEpSW2roD3fK/A1HlmGciBn2In4TpPBj/tbQKLwUYFl8S5uvLpU0MgtFyzmR0x uawwgiqsTTO5FXgmTZ8nr4+41sZnz8IADaRz1kkYuSkUYBrz9YRnTIsAMZLm+vvo56j/ b5AQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si4795380pgh.440.2018.10.24.06.54.40; Wed, 24 Oct 2018 06:54:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727106AbeJXWUf (ORCPT + 99 others); Wed, 24 Oct 2018 18:20:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35814 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726285AbeJXWUe (ORCPT ); Wed, 24 Oct 2018 18:20:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6EB5EC029432; Wed, 24 Oct 2018 13:52:21 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.106]) by smtp.corp.redhat.com (Postfix) with SMTP id 99E095D763; Wed, 24 Oct 2018 13:52:14 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 24 Oct 2018 15:52:20 +0200 (CEST) Date: Wed, 24 Oct 2018 15:52:13 +0200 From: Oleg Nesterov To: Enke Chen Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Peter Zijlstra , Arnd Bergmann , "Eric W. Biederman" , Khalid Aziz , Kate Stewart , Helge Deller , Greg Kroah-Hartman , Al Viro , Andrew Morton , Christian Brauner , Catalin Marinas , Will Deacon , Dave Martin , Mauro Carvalho Chehab , Michal Hocko , Rik van Riel , "Kirill A. Shutemov" , Roman Gushchin , Marcos Paulo de Souza , Dominik Brodowski , Cyrill Gorcunov , Yang Shi , Jann Horn , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, "Victor Kamensky (kamensky)" , xe-linux-external@cisco.com, Stefan Strogin Subject: Re: [PATCH v2] kernel/signal: Signal-based pre-coredump notification Message-ID: <20181024135212.GF30128@redhat.com> References: <458c04d8-d189-4a26-729a-bb1d1d751534@cisco.com> <20181023092348.GA14340@redhat.com> <1e68a3ce-32cd-b058-3d1d-36455ceca848@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1e68a3ce-32cd-b058-3d1d-36455ceca848@cisco.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 24 Oct 2018 13:52:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/23, Enke Chen wrote: > > >> + /* > >> + * Send the pre-coredump signal to the parent if requested. > >> + */ > >> + read_lock(&tasklist_lock); > >> + notify = do_notify_parent_predump(current); > >> + read_unlock(&tasklist_lock); > >> + if (notify) > >> + cond_resched(); > > > > Hmm. I do not understand why do we need cond_resched(). And even if we need it, > > why we can't call it unconditionally? > > Remember the goal is to allow the parent (e.g., a process manager) to take early > action. The "yield" before doing coredump will help. I don't see how can it actually help... cond_resched() is nop if CONFIG_PREEMPT or should_resched() == 0. and the coredumping thread will certainly need to sleep/wait anyway. > > And once again, SIGCHLD/SIGUSR do not queue, this means that PR_SET_PREDUMP_SIG > > is pointless if you have 2 or more children. > > Hmm, could you point me to the code where SIGCHLD/SIGUSR is treated differently > w.r.t. queuing? That does not sound right to me. see the legacy_queue() check. Any signal < SIGRTMIN do not queue. IOW, if SIGCHLD is already pending, then next SIGCHLD is simply ignored. Oleg.