From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, FSL_HELO_FAKE,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C27DCC3B187 for ; Tue, 11 Feb 2020 21:11:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8517620708 for ; Tue, 11 Feb 2020 21:11:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PncgprB0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8517620708 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1B6296B0321; Tue, 11 Feb 2020 16:11:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 140BC6B0323; Tue, 11 Feb 2020 16:11:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 007F46B0324; Tue, 11 Feb 2020 16:11:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D96766B0321 for ; Tue, 11 Feb 2020 16:11:54 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 892DC181AEF15 for ; Tue, 11 Feb 2020 21:11:54 +0000 (UTC) X-FDA: 76479093348.02.seat39_4ac98c6073022 X-HE-Tag: seat39_4ac98c6073022 X-Filterd-Recvd-Size: 6034 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Feb 2020 21:11:53 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id e9so1793271pjr.4 for ; Tue, 11 Feb 2020 13:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WxhnkY2cxQZj5jxzVikeFYowagiLDwBLR0VascuWbEM=; b=PncgprB0dgOZuy/V2ewP9FCKKY2DVqV8yYPqQy8TZPLgR6euCeeY3iEG2c41hmrpa0 +17IrLVrON6RpCIbe6FQ7wRNBIwnAvh0lY1pW51T6WlSi/+LIiuiJxXU7TIB6MuQOlRp HH8T/3hWzhT+JzV3iMtFFtdEa51l74lDo1rR5WuOwIxR97jYhLYgITRKi6WRJGer53T3 U2Xa5CCEFW+lEpfhCWBEaUGWFlaI6xkFj6mTtzEJVskDV9svQeNgJ/bVt9Bu6RIzJ2ay qWSpaI+SwG+7Hht/nfcV+jzi/MyQ31elch2YXLi2e5sRfY4QKlpzHh5/uNyOxA3QxUKZ fcZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=WxhnkY2cxQZj5jxzVikeFYowagiLDwBLR0VascuWbEM=; b=OT4flLNORohfF+4BWrnzNPq/WkPizXlg8vEmfGuiZLMJm0HdtsPO8aXxekyY713oc8 VY7oq+gPOdth8sYJ86jFHIodvbrwNEVHXJjScC1/aU6luUNs2ivCZkYwBE5LlRKfOgrH /EnXSa5r/IiSfsgcW67jcxodnatirWbj+Z4OU60x8/0e7/iN7yCMLc/rEf1lELdQFT7M 5QNebb0Tq43YQ6jV+ZtBt3cki9xsg0/GI7ZJlhSGm69tihDQI3sdfPdfbk5llkUzZmzR mE953OUnSdox9ASKRGjx2cRN+eBsuLHMjGzcP/glK/68zjI8ok2Dgplpp8gWp83ABJm5 oZNw== X-Gm-Message-State: APjAAAVYNDhudYjbrAFUflqf/RPoueWppOmbAOBOEDolGa1dsegfXtWs Ne+7l5TbYa1qDPTW5gl0Qak= X-Google-Smtp-Source: APXvYqx+Gl5TVxWLKV0U/vZkdyFvrWcSzDlyEjHaJ6KkOWlDhX8PBfkfPLw+6IOV5nTbFe4GwSpiDg== X-Received: by 2002:a17:90a:fa94:: with SMTP id cu20mr5983429pjb.114.1581455512792; Tue, 11 Feb 2020 13:11:52 -0800 (PST) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id x4sm5278060pff.143.2020.02.11.13.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 13:11:51 -0800 (PST) Date: Tue, 11 Feb 2020 13:11:49 -0800 From: Minchan Kim To: Alexander Duyck Cc: Andrew Morton , LKML , linux-mm , Linux API , oleksandr@redhat.com, Suren Baghdasaryan , Tim Murray , Daniel Colascione , Sandeep Patil , Sonny Rao , Brian Geffon , Michal Hocko , Johannes Weiner , Shakeel Butt , John Dias , Joel Fernandes Subject: Re: [PATCH v3 5/5] mm: support both pid and pidfd for process_madvise Message-ID: <20200211211149.GC185752@google.com> References: <20200128001641.5086-1-minchan@kernel.org> <20200128001641.5086-6-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 10, 2020 at 03:12:52PM -0800, Alexander Duyck wrote: > On Mon, Jan 27, 2020 at 4:17 PM Minchan Kim wrote: > > > > There is a demand[1] to support pid as well pidfd for process_madvise > > to reduce unncessary syscall to get pidfd if the user has control of > > the targer process(ie, they could gaurantee the process is not gone > > or pid is not reused. Or, it might be okay to give a hint to wrong > > process). > > It looks like you misspelled several items in here including > "unnecessary", "target", and "guarantee". Thanks, will fix it. > > > This patch aims for supporting both options like waitid(2). So, the > > syscall is currently, > > > > int process_madvise(int which, pid_t pid, void *addr, > > size_t length, int advise, unsigned long flag); > > > > @which is actually idtype_t for userspace libray and currently, > > it supports P_PID and P_PIDFD. > > > > [1] https://lore.kernel.org/linux-mm/9d849087-3359-c4ab-fbec-859e8186c509@virtuozzo.com/ > > Signed-off-by: Minchan Kim > > --- > > include/linux/pid.h | 1 + > > include/linux/syscalls.h | 3 ++- > > kernel/exit.c | 17 ----------------- > > kernel/pid.c | 17 +++++++++++++++++ > > mm/madvise.c | 34 ++++++++++++++++++++++------------ > > 5 files changed, 42 insertions(+), 30 deletions(-) > > > > diff --git a/include/linux/pid.h b/include/linux/pid.h > > index 998ae7d24450..023d9c3a8edc 100644 > > --- a/include/linux/pid.h > > +++ b/include/linux/pid.h > > @@ -75,6 +75,7 @@ extern const struct file_operations pidfd_fops; > > struct file; > > > > extern struct pid *pidfd_pid(const struct file *file); > > +extern struct pid *pidfd_get_pid(unsigned int fd); > > > > static inline struct pid *get_pid(struct pid *pid) > > { > > So really this is two patches interleaved. You have the moving of the > pidfd_get_pid function and the update of the syscall. Personally I > would make the function move a separate patch and place it before you > define the syscall and fold the syscall changes into your original > patch. > > Doing that you wouldn't have to worry about the syscall changing in > behavior midway through a bisect. It would either be there or it > wouldn't. Will try it. Thanks!