Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6032370yba; Thu, 11 Apr 2019 10:34:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGSNRtSw0sDxyHkQ7OSwZTZJyXyq0HGGlDpUz1hWuj7UXX9GgMBsd540cWhUbgELTKvU4d X-Received: by 2002:a17:902:694c:: with SMTP id k12mr51771874plt.149.1555004087067; Thu, 11 Apr 2019 10:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555004087; cv=none; d=google.com; s=arc-20160816; b=Q7/xRyVLNtoddKqSwQmxNhFYtDvtHyHnix7wEe1PFCiVrz0Wd/N/TKwKnBUfo7Pb7u Q5w2/wNyqjWytlmSjhG2sHjKdAD0XAwwjEJUvG5N5H/J+ZZ1mc/cv8OMRlKIcteDuvw9 IokWgu4ldSEtAJZjZYR+AaDc7jZauSrtwVXwu08Nl3hLOAIrxDkedlpoydsXpFOVAV69 6jy+/VXHcNa2RCVuJ3ebfvKortYzdesjqBzCL/10OqMHxFHY5HAN2CxDXq36OdTdmTvC gxQrpCuq57SYkCZABzdfJ7Rs5zzNFEYSA6fjIQiVQxEc4IyKNRcOAVZKmPMMR35U/Y2r lRlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OSeB4tqmSiQUf8xagvhoDocOkuTqy8cOj2EPyNoK+Hk=; b=vXs+rCQEqDYGkPBvqFAjayTk5yeYG0IVWXRwlIKjvJ8SSaXFXgAbykiRQfafvVKiHX tj5eRHD2kGRcptPMzQhZdPOdqUjabWec55ckFleTdx69S9brcJ7uamzjsFzC+GXehtU9 tDeaMNYxKE/bpJgcDJphsBAitA30uH7etXZ2i/6aHu0P3tG30uXj257eQupmvbXBGsiO 7PkwPGghpa/pZ76zzi28YJ+hfM1/jb2jgMAWxXOCOJXMba3ODSQtiHQCE2gZHIva/Wt/ HXj0wiDbrApfP/2Ec1mYmvurfU+YKjBme4Za2ZmvSVLC4CRXdBvADdw/Zb60h8yTGuYP x/OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dkPzNjXO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u70si33809480pgd.455.2019.04.11.10.34.29; Thu, 11 Apr 2019 10:34:47 -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=@google.com header.s=20161025 header.b=dkPzNjXO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726798AbfDKRdr (ORCPT + 99 others); Thu, 11 Apr 2019 13:33:47 -0400 Received: from mail-ua1-f65.google.com ([209.85.222.65]:38215 "EHLO mail-ua1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbfDKRdq (ORCPT ); Thu, 11 Apr 2019 13:33:46 -0400 Received: by mail-ua1-f65.google.com with SMTP id t15so2302424uao.5 for ; Thu, 11 Apr 2019 10:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OSeB4tqmSiQUf8xagvhoDocOkuTqy8cOj2EPyNoK+Hk=; b=dkPzNjXOPXQj+xsCF+38A/HaY6qh0VHusVhAJKzysy47FbNOhUUCIcbwMydUH/VcZQ xreBFmJY6sDonha4AADF2FbS3h+SgPFvzvSs+PHAAcTEHIbJn9kqveFOtA9RcplWKd14 lYxptEgekXVtBHwpDoalLAK3qtKwsItHBa9NyZ/MaJj6UoYmNAjWlwbVPzOb1lX8qie5 i++9R1GRweh3laQur+vNb29rB0E8zRVJjyF3KfYxGH302nAAAJcboqi80HRvJ6Yf/yE6 EL+xH3ITdEoKNtoQQcPwilYKEvWXaeoW/7txYVxkVLOexAiCr3feFP4UAP0bDQDG1/Tu FAww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OSeB4tqmSiQUf8xagvhoDocOkuTqy8cOj2EPyNoK+Hk=; b=Yevg8Ydc6oOjn5HGcC+b9IY+2Vs1n2UmRFcp6zgWRJHLQ/+zHYVIzvp5lygzfs6PYW idA9qK+8+t7F+AM4e5g0AmRhuUrctfob28fPdwDHGJds0mZhiqi/ANBOOt1SpstRo2zd 3jBZONLELVezf15LBdVkIm82fbXnECjXR5IMYh3ORjjE9olTjGUxRCf1LkCaKFNeXPtS Zsfq0BgDkPEgxSq+e7OOu1d+9JL2e6l2boIdTR6ELNqXtDNRBNj5gX2xKbwFDJZ6e4FR oy1QMSpbJXeQNtvbr5d2MmzanYCx4SWj8EeOmmGjMKvziluYVDg/vAk/KujPBnyO2jRe 8DWw== X-Gm-Message-State: APjAAAUD+8Ee5xO2ssbM0K0Zea1TCDeuJbB04zId/jJ99qnxOmhyRbUl GP2rYcR1vJKKRetR8KnwiGbMSmUQEgMioS5GKsVxzg== X-Received: by 2002:ab0:3b8:: with SMTP id 53mr4991933uau.118.1555004024530; Thu, 11 Apr 2019 10:33:44 -0700 (PDT) MIME-Version: 1.0 References: <20190411014353.113252-1-surenb@google.com> <20190411014353.113252-3-surenb@google.com> <20190411153313.GE22763@bombadil.infradead.org> In-Reply-To: From: Daniel Colascione Date: Thu, 11 Apr 2019 10:33:32 -0700 Message-ID: Subject: Re: [RFC 2/2] signal: extend pidfd_send_signal() to allow expedited process killing To: Suren Baghdasaryan Cc: Matthew Wilcox , Andrew Morton , Michal Hocko , David Rientjes , yuzhoujian@didichuxing.com, Souptick Joarder , Roman Gushchin , Johannes Weiner , Tetsuo Handa , "Eric W. Biederman" , Shakeel Butt , Christian Brauner , Minchan Kim , Tim Murray , Daniel Colascione , Joel Fernandes , Jann Horn , linux-mm , lsf-pc@lists.linux-foundation.org, LKML , kernel-team Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 11, 2019 at 10:09 AM Suren Baghdasaryan wrote: > > On Thu, Apr 11, 2019 at 8:33 AM Matthew Wilcox wrote: > > > > On Wed, Apr 10, 2019 at 06:43:53PM -0700, Suren Baghdasaryan wrote: > > > Add new SS_EXPEDITE flag to be used when sending SIGKILL via > > > pidfd_send_signal() syscall to allow expedited memory reclaim of the > > > victim process. The usage of this flag is currently limited to SIGKILL > > > signal and only to privileged users. > > > > What is the downside of doing expedited memory reclaim? ie why not do it > > every time a process is going to die? > > I think with an implementation that does not use/abuse oom-reaper > thread this could be done for any kill. As I mentioned oom-reaper is a > limited resource which has access to memory reserves and should not be > abused in the way I do in this reference implementation. > While there might be downsides that I don't know of, I'm not sure it's > required to hurry every kill's memory reclaim. I think there are cases > when resource deallocation is critical, for example when we kill to > relieve resource shortage and there are kills when reclaim speed is > not essential. It would be great if we can identify urgent cases > without userspace hints, so I'm open to suggestions that do not > involve additional flags. I was imagining a PI-ish approach where we'd reap in case an RT process was waiting on the death of some other process. I'd still prefer the API I proposed in the other message because it gets the kernel out of the business of deciding what the right signal is. I'm a huge believer in "mechanism, not policy".