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=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 7EE84C33CB3 for ; Tue, 14 Jan 2020 18:59:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 38D0A24670 for ; Tue, 14 Jan 2020 18:59:50 +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="i2esJgOG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38D0A24670 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 C09F28E0005; Tue, 14 Jan 2020 13:59:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BBA428E0003; Tue, 14 Jan 2020 13:59:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA9518E0005; Tue, 14 Jan 2020 13:59:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 920008E0003 for ; Tue, 14 Jan 2020 13:59:49 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 5A605180AD81A for ; Tue, 14 Jan 2020 18:59:49 +0000 (UTC) X-FDA: 76377154098.04.pet42_38988413a580a X-HE-Tag: pet42_38988413a580a X-Filterd-Recvd-Size: 7001 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 18:59:48 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id b137so6812962pga.6 for ; Tue, 14 Jan 2020 10:59:48 -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=ZLdWsGP0XHWGCxqVZhBLWctk+c6rDeF6k4vcD9DPHeI=; b=i2esJgOGFaemeAJAp/5QuOJMkYpdkKC+BLVc3D4N2IEPIwfcCJcCSPc/Rp3CxvQcSX 8kRFU0HiBO9tAtgVGddZGvBf66yxgIoiUP2gAFr9YIvFs3e1tJCgnaRRF3+HT3F6hCVX HQUUXaaol4cLeN7aKj8yFkgcOpznc1FoOoXd6AeqMXb4zSwz+GxGgcMO6ULnsUFnZfTQ +uWHsyf5dvD13xhpYMo/FUR/Rs3U11m8KLSDY1X1u9UZAfhcWHvVfUfIqeJXH4qpKJlE eZubYzsEvAnrRoY2zi3DmJb8WFDVO05RQQDJ1WGC8Lz+Fj0k2Jc/8s24Ix0/pXV9Txhr WSwQ== 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=ZLdWsGP0XHWGCxqVZhBLWctk+c6rDeF6k4vcD9DPHeI=; b=MCG45ezfZ1qVCiyu1Bm47M7oSUHXrrMCz66ikS2JlmkX6xIi+VwB4PcQQN6KfGhuVK BxP3i1rnpjPVwsaHT7ysK9XTQVdlCHUlqLBWkMXMGqPNTqXBwRe6oOCMAp1FSejuAhJY jMFHQdhIsa+ICBaYgjPLZPvDkA+jhUsc/bFmnEh05uurDkL4cn5Mzydqly3SSCbVciLi aRwDxVD8ID2ERDr29yKL5BWG7bbdA9Dsu43RKU3vV0opIMkx5TJSkFyal8/RAvIobCt0 obB9w9FDmzVjQfEm9iAGTNI7YYcFzJgbv7vg3fK1KEE5/oxFcoDtH8AvSpvyUK2XF2lH EFxg== X-Gm-Message-State: APjAAAVMv+Njc+pFR+Y0G+9wqMpm43NNPYV+DjcDQMRafxfPBDf4x0uK xhow/dk/kvO6DB7CFOSLnQY= X-Google-Smtp-Source: APXvYqy/N+z69PG6y7Ebj6znXULG+UpZs19rlNT7fvG0Mt2TmO28ChC4a53hBPhfkDlB2m58VsHirQ== X-Received: by 2002:a63:ed56:: with SMTP id m22mr28041543pgk.261.1579028387395; Tue, 14 Jan 2020 10:59:47 -0800 (PST) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id b4sm19392543pfd.18.2020.01.14.10.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 10:59:46 -0800 (PST) Date: Tue, 14 Jan 2020 10:59:44 -0800 From: Minchan Kim To: Christian Brauner Cc: Kirill Tkhai , Michal Hocko , 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 , Johannes Weiner , Shakeel Butt , John Dias Subject: Re: [PATCH 2/4] mm: introduce external memory hinting API Message-ID: <20200114185944.GA178589@google.com> References: <20200110213433.94739-1-minchan@kernel.org> <20200110213433.94739-3-minchan@kernel.org> <56ea0927-ad2e-3fbd-3366-3813330f6cec@virtuozzo.com> <20200113104256.5ujbplyec2sk4onn@wittgenstein> <20200113184408.GD110363@google.com> <20200113191046.2tidyvc544zvchek@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200113191046.2tidyvc544zvchek@wittgenstein> 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: Hi Christian, On Mon, Jan 13, 2020 at 08:10:47PM +0100, Christian Brauner wrote: > On Mon, Jan 13, 2020 at 10:44:08AM -0800, Minchan Kim wrote: > > On Mon, Jan 13, 2020 at 11:42:57AM +0100, Christian Brauner wrote: > > > On Mon, Jan 13, 2020 at 11:47:11AM +0300, Kirill Tkhai wrote: > > > > < snip > > > > > > > > +SYSCALL_DEFINE5(process_madvise, int, pidfd, unsigned long, start, > > > > > + size_t, len_in, int, behavior, unsigned long, flags) > > > > > > > > I don't like the interface. The fact we have pidfd does not mean, > > > > we have to use it for new syscalls always. A user may want to set > > > > madvise for specific pid from console and pass pid as argument. > > > > pidfd would be an overkill in this case. > > > > We usually call "kill -9 pid" from console. Why shouldn't process_madvise() > > > > allow this? > > > > > > > > I suggent to extend first argument to work with both pid and pidfd. > > > > Look at what we have for waitid(idtype, id_t id, ...) for example: > > > > > > > > idtype == P_PID > > > > Wait for the child whose process ID matches id. > > > > > > > > idtype == P_PIDFD (since Linux 5.4) > > > > Wait for the child referred to by the PID file descriptor specified in id. (See pidfd_open(2) for further information on > > > > PID file descriptors.) > > > > > > > > We may use @flags argument for this. > > > > > > Sorry for chiming in just a comment. Overall, I don't particularly care > > > how or if you integrate pidfd here. One thing I would like to point out > > > is that we're working on a patch to place new features under pidfd > > > specific flags. This e.g. means a pidfd would be only be able to be used > > > for madvise operations (or getfd operations) if it was created with that > > > specific flag set making it easier to share them with other processes. > > > So if you integrate them here I would be quite thankful if you target > > > the patchset for the v5.7 merge window, not for v5.6. > > > > Hi Christian, > > Sorry but I couldn't understand your point. > > Could you clarify what you meant? > > Hi Minchan, > > Sure. When you create a pidfd, e.g. with clone3() and you'd wanted to > use it for madvise you'd need to set a flag like pidfd_cap_madvise or > pidfd_feature_madvise when you create the pidfd. Only if the pidfd was > created with that flag set could you use it with madvise (This does not > affect the permission checking you're performing here.). This has come > up a couple of times and becomes more relevant now that people keep > adding new features on top of pidfd and is similar to what we are now > doing with openat2(). Thanks for the explain. When I read discussion with you and Daniel, it's still vague for me that what's the outcome so that it could land onto v5.6.(If I miss something progress on other thread, sorry about that.) I will keep Ccing you so that you may notice when this patchset could be merged(Please Cc me when you send your patchset for me to notice) So if we judge it's worth to integrate, maybe we could make a quick patch to use it or postpone a cycle to intergrate it if we have more time. Thanks.