Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4951520ybl; Tue, 14 Jan 2020 00:41:09 -0800 (PST) X-Google-Smtp-Source: APXvYqyY5e8zURe51qn8rcgrFNinJHNyLeziGXy+l7NpaGt6V6g1jZ6i/cnvrrjjZkF+yBPbKIO2 X-Received: by 2002:a9d:c42:: with SMTP id 60mr15674358otr.182.1578991269717; Tue, 14 Jan 2020 00:41:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578991269; cv=none; d=google.com; s=arc-20160816; b=xCmz6Y4O2h+S+ovPmmEZUmTUSKbQmoHrgYZtxl9PK7dVb6haSWBUgO2UffVhjkm2Me T5CKFWjl+t555evggPqgWBbgZ+HYlzoCM8D816TEJKnSgyuRMeFmuzfb4lP2Hk221oaL i+HIACWY1t8/qIe7Z4hO+4XTwybWWxXxt2gt0iQddgllYLGJ2jG4OWg7QawWrbvKsSxR nRreS56qlXx/sz32qL3ESqL/paHKV+8k3S9j0zPyii4hSkYmat7JUMnRpqHfPwzliaL6 l5nZVi9MQxewPMGYMW+dSg3L4Z1rtHFMyZNmwgQhokseO1N8sSFcsZX4NayK7PLAVsnU Ot1A== 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=f5pnH8RExUEldFwMtXcvGqFnH3xQYVpfl1cMlkCShc0=; b=UXFeg3xDssFRCxVzhanzSOVWz7D5oO5oRjag2jOYHb+GkrWDfXpMa7XT4mYcU5Jwpp D5QyTACYky3GfPUZV6OfD/A9vYZl4ZCPdtkTpAJnA5+pZgEZ7qikfMlQs0Cn8FxmcEo9 LBpelNY0YJVVuZPgDe5cgVbJrY+kJBJ33hE4usY3ZQxg+MaPRYSvSRdsFCcTk6d9nWdg DvXt24Jzu02iXyXVFKLSzepgB6hgpkDjz8HarbjBcXV0o5XDsgm8rqaOcDtZm3KQ9wrx 4NkFYXe2duM0R0CIdJGHmxdupcXmQlxSURXxh60utfcttmNO7xOs3SD1D7Q1wF8GvGFL NIYA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si7219924oib.104.2020.01.14.00.40.58; Tue, 14 Jan 2020 00:41:09 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728665AbgANIkA (ORCPT + 99 others); Tue, 14 Jan 2020 03:40:00 -0500 Received: from relay.sw.ru ([185.231.240.75]:53820 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727083AbgANIkA (ORCPT ); Tue, 14 Jan 2020 03:40:00 -0500 Received: from dhcp-172-16-24-104.sw.ru ([172.16.24.104]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1irHjU-0005aa-Ob; Tue, 14 Jan 2020 11:39:29 +0300 Subject: Re: [PATCH 2/4] mm: introduce external memory hinting API To: Daniel Colascione Cc: Minchan Kim , 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 References: <20200110213433.94739-1-minchan@kernel.org> <20200110213433.94739-3-minchan@kernel.org> <56ea0927-ad2e-3fbd-3366-3813330f6cec@virtuozzo.com> From: Kirill Tkhai Message-ID: <3eec2097-75a3-1e1d-06d9-44ee5eaf1312@virtuozzo.com> Date: Tue, 14 Jan 2020 11:39:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: 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 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.