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 99D89C33CB3 for ; Tue, 14 Jan 2020 19:12:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 62952222C4 for ; Tue, 14 Jan 2020 19:12:45 +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="FAh3QOQ1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62952222C4 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 F34478E0005; Tue, 14 Jan 2020 14:12:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE4998E0003; Tue, 14 Jan 2020 14:12:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFA8A8E0005; Tue, 14 Jan 2020 14:12:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id C99628E0003 for ; Tue, 14 Jan 2020 14:12:44 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 9D8B0181AEF07 for ; Tue, 14 Jan 2020 19:12:44 +0000 (UTC) X-FDA: 76377186648.30.fifth03_17dd3d76a4743 X-HE-Tag: fifth03_17dd3d76a4743 X-Filterd-Recvd-Size: 5994 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 19:12:43 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id i23so7039559pfo.2 for ; 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=uajwKC9tb5JUaBcGE1lY0nLYprpsSmmCs05kilvZvW9Sy2B/uS6jiJVIOddpvVS5Ne yx65zZb1xN0aA/ggVtk2g0i0qlosRzxnpMbvpGobaf5GpKYOn8Y/GxG9J0QGjw0fYnfi 0nm/hS9pPJeGYzPHCYi+6a2jMh8JKee5WwQjmOLllEiFPQlBnhI/HrvnjsehheH99Ilv HzEx7f+MbyJtYON0twWYXSbcx7Jg/IdkaBFbDd3fmxqm6qeyzQcRiVHsxkUMOHEuPcYd DY5C6Uw2gvQjjmCiAoM8MH6fTrcbTS+RcsVww54f81RpxGpvWAcbS7yiVWfep1EKKdtq W9uw== X-Gm-Message-State: APjAAAUMjWYDdRFPG9iHvIYCXYqhZF1pKDle6OnilZ4s9SBT2AH23aPv 2Cn4AafxpK2oIARSrYBx3iE= X-Google-Smtp-Source: APXvYqyX2/Ztqg7zQzkHX1bJyFkvAa04iBHiUGPG+wyB3Anf0nnb8KK8PuqFSwewo4GCFsiXAryL3w== 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) 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, 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.