Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6720567ybf; Fri, 6 Mar 2020 03:16:22 -0800 (PST) X-Google-Smtp-Source: ADFU+vsgTX/tK37SKf/AHEeJjQe3gkmTlSeeHMTDOe+iQ20s0sXRw6LQ+OgiJWC12GqBS+PHEFcD X-Received: by 2002:aca:1319:: with SMTP id e25mr2114009oii.4.1583493382569; Fri, 06 Mar 2020 03:16:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583493382; cv=none; d=google.com; s=arc-20160816; b=EzKExU6Kgot/5hl0Y2oGxZWblQlM6T8Tmwas+Ld83C/n+WjPz9fUsbErCbH0pAJ0+v vOxepMzshpaM5NeT/xX51ra/kbr/XQvkI3wrpjysZwNYJppw1WdBTg5OMsV6EY7Zx6Ck z13IP6PAm2E6t/c8QO73YOGYhbnh+wZSofwA+g4TvPxzmjxuv6zzigOf+MMqxa2RDFOT fhe9LcDXZC2RF8AoMldFQUNRxPMtktJjaGO8Gw2I7nB16jyyxMeXeEUc8kaVh4ICLbPP ntFtXK3VfZ6xR0sRqv+k+s99wxwV4cTeG3zxZf14yf2pQ0NkkpaDWGkatipOF6v5STvc oaKA== 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; bh=8Bk16ScpEy+0mPXkRRTYlP7P5dJ0pnhouE9+ICeAZ9s=; b=Z3G/r9niuow+czBNI+EYOljP4Z9EMnGS732SQ9a6ogxKkB4t5qeDiMG3O97c5XpRMR lyFSSSFmzw+g+1w9Wx0iIavClkluA3Ggl+f2LyX9u+0qgC8lK9adzijwuKpIyX2dmL7Y DMh9MgHTL6FsK770PxJRyxutLdv7HcNA660EJ8A+RXWKnVvl2zs/N5aJCInZ1/0hwtYB YekYCOB4t5J0lKc41s1uPlXcn3wqY1an8gGaOx/QNYzqJsSNaMXF5JiR7JVXwiZMIfEw CETjK7UkaVZKSxhe4ds1Paua45yNciF23OnDGLTkhKw9r2M2tgAU5i7zZ1XQJRJ3n9gh 8Idg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f136si1085739oib.88.2020.03.06.03.16.10; Fri, 06 Mar 2020 03:16:22 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726956AbgCFLOZ (ORCPT + 99 others); Fri, 6 Mar 2020 06:14:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:43826 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726873AbgCFLOY (ORCPT ); Fri, 6 Mar 2020 06:14:24 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E631BB1D1; Fri, 6 Mar 2020 11:14:21 +0000 (UTC) Subject: Re: [PATCH v7 5/7] mm: support both pid and pidfd for process_madvise To: Minchan Kim , Andrew Morton Cc: LKML , linux-mm , linux-api@vger.kernel.org, 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 , Jann Horn , alexander.h.duyck@linux.intel.com, sj38.park@gmail.com, Christian Brauner , Kirill Tkhai References: <20200302193630.68771-1-minchan@kernel.org> <20200302193630.68771-6-minchan@kernel.org> From: Vlastimil Babka Message-ID: <14089609-5fb1-b082-716f-c2e129d27c48@suse.cz> Date: Fri, 6 Mar 2020 12:14:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200302193630.68771-6-minchan@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/2/20 8:36 PM, Minchan Kim wrote: > There is a demand[1] to support pid as well pidfd for process_madvise > to reduce unnecessary syscall to get pidfd if the user has control of > the target process(ie, they could guarantee the process is not gone > or pid is not reused). > > 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); This is again halfway between kernel and userspace description, so if we stick to userspace then it's: int process_madvise(idtype_t idtype, id_t id, void *addr, size_t length, int advice, unsigned long flags); > @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/ > > Cc: Christian Brauner > Reviewed-by: Suren Baghdasaryan > Suggested-by: Kirill Tkhai > Signed-off-by: Minchan Kim Reviewed-by: Vlastimil Babka