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=-3.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 50D84C47255 for ; Fri, 8 May 2020 18:36:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C49121974 for ; Fri, 8 May 2020 18:36:59 +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="e9phhNfq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C49121974 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 ACAE1900006; Fri, 8 May 2020 14:36:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A7C64900004; Fri, 8 May 2020 14:36:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 991D9900006; Fri, 8 May 2020 14:36:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 80AE1900004 for ; Fri, 8 May 2020 14:36:58 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 341D0181AEF1A for ; Fri, 8 May 2020 18:36:58 +0000 (UTC) X-FDA: 76794408516.25.hen49_296224d4e142 X-HE-Tag: hen49_296224d4e142 X-Filterd-Recvd-Size: 6843 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 May 2020 18:36:57 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id e6so4659255pjt.4 for ; Fri, 08 May 2020 11:36:57 -0700 (PDT) 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; bh=DI4jr073qlq2kMXmJOvGcOhiGeUasYxQR1ZwT0O6BJc=; b=e9phhNfqFy4SUFWgk2EkceTCIXKBpoo+T6gbLnaezV4G1B1/6lGhJ9ZcLZnuIelgrn Ql4cXp0/PLMBEjmnbd2PNYpKCM9yzKGC3CymbAKLYUct+zd+y/b8iq4Ky/HQZw9RQrIY xsTziG+UJ7AhftkBwChU8kc9ifBpNVlPOuwtpKv1eySwSaFBPFq5dJ4usA5J2F/H+v6m vktpsEvHDUu22Sy7Bu5cLx4TwMhNuNvPG0WBDsdtsVacNNxZmnxGqbJerhxm+TOunoDS 2wKFP/FJdInr5l49rJI1sh1qd9ISmsRyxCk2BCLIMDZe6Ql6K/PqU2ITpyvLxqk5XBUL Ta6Q== 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; bh=DI4jr073qlq2kMXmJOvGcOhiGeUasYxQR1ZwT0O6BJc=; b=GIBrq2kSGbXsWjZvkWw/EKaNPtbMZSlsamGMKSUmL8CS838n1JerXUCmOxpqQ931iZ U06T3WcV+r6+4iWouhoydg+he4XcqlGCiu8F/IsHE+FaSMsv6f5vkaWjqm2t2cwvNCUQ 5bcGIOenk+b4qUHrfcbOQCTv/15z1U7w0NwzMvxDJbO0GCGYm13Dgt2fitgzTuGGaumg EXmiEbjr5Cjk2PgK9SE0/u7yG1ak8dmLR67JIcbAwOnYrkr/HFhkzgCrigIqZ2G8axD4 ovWL5i90ybr0VeP0+Ro8u6ZUxiwLSnadmbnL4q0er3PUf/oOuSNX/78O7dbKny7jvlp2 qgxQ== X-Gm-Message-State: AGi0PubZMgzPSEAnkHOqs18DlslzEZnnPK830cXPzTGtUumz2sxVI4C1 UI/5n2K0nRKPqPbDQs3bF1Q= X-Google-Smtp-Source: APiQypKgW5Qc0p3xd2HpZcE+oAgc4345/KXJgo5T1enrKQgtp+/zxkhsCUo1kw0ffKngWDoRgVGTKw== X-Received: by 2002:a17:902:4c:: with SMTP id 70mr3617494pla.336.1588963016739; Fri, 08 May 2020 11:36:56 -0700 (PDT) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id mn1sm2880315pjb.24.2020.05.08.11.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:36:55 -0700 (PDT) Date: Fri, 8 May 2020 11:36:53 -0700 From: Minchan Kim To: Vlastimil Babka Cc: Andrew Morton , 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 Subject: Re: [PATCH v7 5/7] mm: support both pid and pidfd for process_madvise Message-ID: <20200508183653.GB125527@google.com> References: <20200302193630.68771-1-minchan@kernel.org> <20200302193630.68771-6-minchan@kernel.org> <14089609-5fb1-b082-716f-c2e129d27c48@suse.cz> <20200311004251.GB87930@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200311004251.GB87930@google.com> 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 Tue, Mar 10, 2020 at 05:42:51PM -0700, Minchan Kim wrote: > On Fri, Mar 06, 2020 at 12:14:19PM +0100, Vlastimil Babka wrote: > > 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); > > Yub. > Hi Andrew, Per Vlastimil's request, I changed "which and advise" with "idtype and advice" in function prototype of description. Could you replace the part in the description? Code is never changed. Thanks. >From f11cfd023746ae67b89f2d84d960706ba6c5c911 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Wed, 6 May 2020 13:54:40 +0000 Subject: [PATCH] mm/madvise: support both pid and pidfd for process_madvise 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(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/ Link: http://lkml.kernel.org/r/20200302193630.68771-6-minchan@kernel.org Signed-off-by: Minchan Kim Suggested-by: Kirill Tkhai Reviewed-by: Suren Baghdasaryan Reviewed-by: Vlastimil Babka Cc: Christian Brauner Cc: Alexander Duyck Cc: Brian Geffon Cc: Daniel Colascione Cc: Jann Horn Cc: Jens Axboe Cc: Joel Fernandes Cc: Johannes Weiner Cc: John Dias Cc: Michal Hocko Cc: Oleksandr Natalenko Cc: Sandeep Patil Cc: SeongJae Park Cc: SeongJae Park Cc: Shakeel Butt Cc: Sonny Rao Cc: Tim Murray Cc: Signed-off-by: Andrew Morton