Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1120635ima; Wed, 24 Oct 2018 14:56:53 -0700 (PDT) X-Google-Smtp-Source: AJdET5cSZdfj+AaFFovdYCEgI5OrOh1raIlf0nwLLXjVxlkQiYeOZIrgB25HOEJIkFiRTJSIPYv5 X-Received: by 2002:a17:902:96a:: with SMTP id 97-v6mr3913265plm.32.1540418213504; Wed, 24 Oct 2018 14:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540418213; cv=none; d=google.com; s=arc-20160816; b=kHjFtZDJYmfZM6tbzF9wQjHSdExw17sKgCzSjfTkuOxZmQILkoTMhdzSK1XtEV51TV 5W5HAd6eJJ8rtD8u12EmjQPtG/6lapdcbrIkrjd3Z7RQJJMmP4b40wTPEGx8oxnw2lDD H1udFF2txhFOxdUNqXHErRbUSlXt7PjTKQCrlGWusszOMP0nLgkWBw9lWHTZUXE/SZLh wkL7Vuu2G6PFUPmUIC8TZ0E0FJ+8akGDKy2yXpTalq5dPczxEQi/7+VNCIj90S8dHor9 bPZHfIyTqtOR/RWZmAOEEy9g3MJOePK/suw+0Bg5HOTZWnt39MRjhigo/0aEjvyr8rs/ NLPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=qNNAJ7iHZ06om4BKUvDoXzGrv0BqObQkdUjrS56vPKs=; b=WAz2BRjkI4ZCKFxn8vJsYvDttVbcwHh7UljlTOPsS0QwLrqH4pM2/iwRbRBN60O29m goJOVslN2Rh+S+km5RcxsYWiqWmKpmREAmDvMY5ecGGMB1zEg9gnUQPiEaiJiuD38Lx9 zfOvWo+40Q1Vj7MnUz7LcSHT5Ni/RHwXX6bRufcTMKMRaO/jQM/HgBH29Z76sbs12AP0 2h+Ykg4KrKp65x/i/nL8gNtl6CAGG8umAcjTjzreNjraFFrPPUQyM4V4LgXGhLqUwwb+ IfA8tJCm/eLeO3Kb3CG/TWscCSaY70UYc50dfr9QbVw1GA2gVz/mFYgnx//dkd26N4eL G3lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=N+gLIw48; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id go1si5545859plb.242.2018.10.24.14.56.37; Wed, 24 Oct 2018 14:56:53 -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; dkim=pass header.i=@cisco.com header.s=iport header.b=N+gLIw48; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727073AbeJYG0D (ORCPT + 99 others); Thu, 25 Oct 2018 02:26:03 -0400 Received: from rcdn-iport-9.cisco.com ([173.37.86.80]:30733 "EHLO rcdn-iport-9.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbeJYG0D (ORCPT ); Thu, 25 Oct 2018 02:26:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1776; q=dns/txt; s=iport; t=1540418175; x=1541627775; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=IV6orGr/xdbqlrK35ApBylp9n16mmZ0zFDuRyL2MVRk=; b=N+gLIw48De2+shZUfDMu7QxVcIpg7cY+OTWgQ9D+8mlLg+MdWMReWMA4 v3Yzjwp8vXq+fVMfsBOzyYIlMZgG56xNY0D6oq5y2zF/YK9CRiehnal3D JeVzsu077OSRhmBHQtGpHKMqS8P4IgfKWAbeDA54mGX8n4i2E9u/Xn8Ps c=; X-IronPort-AV: E=Sophos;i="5.54,421,1534809600"; d="scan'208";a="386539682" Received: from rcdn-core-9.cisco.com ([173.37.93.145]) by rcdn-iport-9.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 21:56:14 +0000 Received: from [10.154.208.140] ([10.154.208.140]) by rcdn-core-9.cisco.com (8.15.2/8.15.2) with ESMTP id w9OLuCGJ009286; Wed, 24 Oct 2018 21:56:13 GMT Subject: Re: [PATCH v2] kernel/signal: Signal-based pre-coredump notification To: Oleg Nesterov 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 , Enke Chen References: <458c04d8-d189-4a26-729a-bb1d1d751534@cisco.com> <20181023092348.GA14340@redhat.com> <1e68a3ce-32cd-b058-3d1d-36455ceca848@cisco.com> <20181024135212.GF30128@redhat.com> From: Enke Chen Message-ID: Date: Wed, 24 Oct 2018 14:56:12 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181024135212.GF30128@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-SMTP-Client: 10.154.208.140, [10.154.208.140] X-Outbound-Node: rcdn-core-9.cisco.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Olge: On 10/24/18 6:52 AM, Oleg Nesterov wrote: > 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. I am really surprised by this - cond_resched() is used in many places and it actually does not do anything w/o CONFIG_PREEMPT. Will remove. > >>> 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. Got it. This means that a distinct signal (in particular a RT signal) would be more preferred. This is what it is done in our application. You earlier suggestion about removing the signal limitation makes a lot sense to me now. Given that a distinct signal is more preferred, I am wondering if I should just remove CLD_PREDUMP from the patch. Thanks. -- Enke