Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5575123ybl; Tue, 14 Jan 2020 11:13:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwznynOzz8RmCIpX8wao9IYyYieyBpsS4bfvrMt5v02gmhAdSYoY8aw9ix4xbQ8n+KG9gF2 X-Received: by 2002:a54:4396:: with SMTP id u22mr18352706oiv.128.1579029227760; Tue, 14 Jan 2020 11:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579029227; cv=none; d=google.com; s=arc-20160816; b=r6ZilO7cryYhRs6Eyva5kcHbsRZPXrOITg+e24Ky+/su18XVHLYieKHw+/6c+PmlBW TgEC+oWiCjwVQlD8blz3P9kuSu95Yaa7bCiQjjctV8qLpDTe0iWCbV8Y4KUkky4BQhEl BnKH+7gPaF3YYqibyaRxRi2vmiAIkFi3KVrL5bVG4j69I29rOwSpaoF74lAH1LH8pV8n OgHlRHIIOHWcEUOY3iqizTpt3KsYg+Xyzn9NZC1/Mq+UmcLklzmioI9Nq6w0+yfULrKK wpfvvJRxsuURnHrkIbe5Y/BPlYJsKm+E9Hnu/AYT+/e8/v953thU0+ZncrKyHnZ5Sn0r Jd1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=f63B2LvCWNuhkfnuBRLARt3WlWJAkv9H8cQcBpg+JxA=; b=KFJNwP3LG+5U7sKaUqjwMiJCl8WBhWhqtJSqDhXKh/8psNJhTVsdz+QMy/3OcYU8Ku TmEbePi1oTNFKtcYI9tPT1WO8GFbCZOt8Os3HZ/Z8+6kyEyPjuaulFK1KhFzSxH/ZxGg RQW86pivbvcSoToimAGrzpiBYQGUTtVi4rdqbauygbfokJPtAApgYwhQ1k/olfJnslRK KrVpqudISlxT+ksjrPfBxZNVnZOGDh+W1U+bMODbHftmMB13BhQ94imIJiyTvr8qKRSs pVMjsVIIWCuf5+I+RHN9xrc0U3HWHx9bnBjb6NOUxeAji2U7fTkXRpznurxDp+TRQzc3 7zaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=FAh3QOQ1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j143si7868801oib.16.2020.01.14.11.13.35; Tue, 14 Jan 2020 11:13:47 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=FAh3QOQ1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728748AbgANTMo (ORCPT + 99 others); Tue, 14 Jan 2020 14:12:44 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33859 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgANTMn (ORCPT ); Tue, 14 Jan 2020 14:12:43 -0500 Received: by mail-pf1-f196.google.com with SMTP id i6so7037076pfc.1; Tue, 14 Jan 2020 11:12:43 -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=f63B2LvCWNuhkfnuBRLARt3WlWJAkv9H8cQcBpg+JxA=; b=FAh3QOQ1X9MK9Pkn9EPZC1KsIdUlp49a/rCb3pGSAITaan1p0Ol+Z7s8PCAXCawGqs Aa/ExjygiJ+AtFLNFlladFpAl8pFyc/NyExixttixtN5ciGxwpzMPof30OJnzlegvZY0 /s/oOvu65AKFBuvQDrMfdkyHaOwhX7xUnUhWOVhx1wWUbqMvNkIjnC1t3BkSTAIw/2+s EPPshBT+J1/T3JPY2XqkRc6ZdKJAxilRZu4bIMTGTdqowbXS6XxpBT4K0ZIzbHtb8qNg fbTyUw8d1pqhgT/fkk8utuPbGZrAFBj8+JK1nlcvG3jdWmlKyQGTzgqTlnBe3eoWtNRK RWaQ== 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=f63B2LvCWNuhkfnuBRLARt3WlWJAkv9H8cQcBpg+JxA=; b=j2B1lTi5AaNnCW50WGCRDqtsEbxIDh8lNBv0t1piRlnun/GD5pO+2VF+UVg72enDF7 TVRQ+9mrBpzINP3ubf82cb1j+hv2x5SRuNpO8vdtanOJNN4AXY7rRp/bvYYHJRnkQYFK e1kRBmcMqSnoR0x/XqU4Nx6swhC8wIqknk/nNAp6wI8Yg7SJ3LVP65YiQ39OnV2gtT57 7PrDQfcfbIHjUuW7dmxShiT8UXZLDYZI58l9BP8VOMf++RzZowf+0+PZkqxX2zyx3ytu QXwoOp1tM9/bjMrh7njUyVEBziZEeWmNXyfdjkrIASlP/EJfT8O9yS0pIrgi4q5waHBl cEOQ== X-Gm-Message-State: APjAAAWYE+tdLr5+CnWntQQis4DRJdk4kKD2d6dpcMyDowNgoLq5/YIw eY9+IDQ36kvPqkSjtCk930U= X-Received: by 2002:a63:b141:: with SMTP id g1mr29790386pgp.168.1579029162494; Tue, 14 Jan 2020 11:12:42 -0800 (PST) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id b21sm20330960pfp.0.2020.01.14.11.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 11:12:41 -0800 (PST) Date: Tue, 14 Jan 2020 11:12:39 -0800 From: Minchan Kim To: Kirill Tkhai Cc: Daniel Colascione , Andrew Morton , LKML , linux-mm , Linux API , oleksandr@redhat.com, Suren Baghdasaryan , Tim Murray , Sandeep Patil , Sonny Rao , Brian Geffon , Michal Hocko , Johannes Weiner , Shakeel Butt , John Dias Subject: Re: [PATCH 2/4] mm: introduce external memory hinting API Message-ID: <20200114191239.GB178589@google.com> References: <20200110213433.94739-1-minchan@kernel.org> <20200110213433.94739-3-minchan@kernel.org> <56ea0927-ad2e-3fbd-3366-3813330f6cec@virtuozzo.com> <3eec2097-75a3-1e1d-06d9-44ee5eaf1312@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3eec2097-75a3-1e1d-06d9-44ee5eaf1312@virtuozzo.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 14, 2020 at 11:39:28AM +0300, Kirill Tkhai wrote: > On 13.01.2020 22:18, Daniel Colascione wrote: > > On Mon, Jan 13, 2020, 12:47 AM Kirill Tkhai wrote: > >>> +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? > > > > All new APIs should use pidfds: they're better than numeric PIDs > > Yes > > > in every way. > > No > > > If a program wants to allow users to specify processes by > > numeric PID, it can parse that numeric PID, open the corresponding > > pidfd, and then use that pidfd with whatever system call it wants. > > It's not necessary to support numeric PIDs at the system call level to > > allow a console program to identify a process by numeric PID. > > No. It is overkill. Ordinary pid interfaces also should be available. > There are a lot of cases, when they are more comfortable. Say, a calling > of process_madvise() from tracer, when a tracee is stopped. In this moment > the tracer knows everything about tracee state, and pidfd brackets > pidfd_open() and close() around actual action look just stupid, and this > is cpu time wasting. > > Another example is a parent task, which manages parameters of its children. > It knows everything about them, whether they are alive or not. Pidfd interface > will just utilize additional cpu time here. > > So, no. Both interfaces should be available. Sounds like that you want to support both options for every upcoming API which deals with pid. I'm not sure how it's critical for process_madvise API this case. In general, we sacrifice some performance for the nicer one and later, once it's reported as hurdle for some workload, we could fix it via introducing new flag. What I don't like at this moment is to make syscall complicated with potential scenarios without real workload.