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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96F0FCFA453 for ; Wed, 23 Oct 2024 17:18:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 25A046B0089; Wed, 23 Oct 2024 13:18:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E2FB6B008A; Wed, 23 Oct 2024 13:18:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0AB756B008C; Wed, 23 Oct 2024 13:18:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E08476B0089 for ; Wed, 23 Oct 2024 13:18:40 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1CFF5140974 for ; Wed, 23 Oct 2024 17:18:22 +0000 (UTC) X-FDA: 82705525770.25.1BE98FB Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) by imf13.hostedemail.com (Postfix) with ESMTP id 97E0A2001C for ; Wed, 23 Oct 2024 17:18:20 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ejRfu9sN; spf=pass (imf13.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.176 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729703867; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xnlqPphUlvB/1649QsAjYZZfPNSeq62kbrW+yz2Z4Os=; b=mMwU1/cHNv+9E2Kbyd2n8xfdP40A13bZ3gqdH9cmMMNr+acNl/YKlR34pYcL3FQICzc28d OkLJbjnqAZpP/9j6xz1Lf++2E6bQ6FEPClcft6XCir3biBNLhuUbKTSbu+uGdyB4L00gW2 Huz59O84KQQXeXe3R2KszLuXJHoMkeY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ejRfu9sN; spf=pass (imf13.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.176 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729703867; a=rsa-sha256; cv=none; b=ZhWB6SN0CwExTmUHKUSutycW0HXgd+MunN09PAw5QNXnG+i+3gixLM3XG3N41stC2tkDp2 FJlVQxQ/OgbhCdWTYWZX9ZbX1JuVeuO+sricOtJts1Egv18nRvGDk+bhMbbRHP2e1f9uTl 2Y4iL2ILh/8au/DutRNfEFyBrwIXoyk= Date: Wed, 23 Oct 2024 10:18:28 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1729703916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xnlqPphUlvB/1649QsAjYZZfPNSeq62kbrW+yz2Z4Os=; b=ejRfu9sN5leVVaRjsUR+02NiUcIiRhmvWNveczbcBA2SgGYzlxZPxcrQtRF9QURa9gTe5s lmHqN/bMSQ/XQxvNdqi/n5xFj4uzp90+nokWUytlht7dc5ZiE8LDccbpNyubfyGRIn55Md ZajitSJz4USnabBE9/WlmotgFPr0Zec= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Lorenzo Stoakes Cc: Christian Brauner , Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Sang , John Hubbard Subject: Re: [PATCH v4 2/4] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process Message-ID: <35ipnq7dik6skpgrsywtje734iam65h2zjsv7fv5ayzfwnjlph@odu2szclos5y> References: <3bf7f2d8efc768007b5de8122275405afc9942d4.1729198898.git.lorenzo.stoakes@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Stat-Signature: wfygptmrpwqm8bx6je4hu4zowf4xsapg X-Rspamd-Queue-Id: 97E0A2001C X-Rspamd-Server: rspam11 X-HE-Tag: 1729703900-292898 X-HE-Meta: U2FsdGVkX1+u2Z8vNF3tuZAq1QbRFw6ZGfyH0r7vRdyH0CWmQ4ZNrL2tWpHthEwVz9bI4lQ+cOfJmNcEM3cOXtJrO7SB90xpsffbYl3Q1xJWnrA73v0mFMDLTgRKHZDHTC0R2NWtmUlrm4W2jJx2We6PM0qi3FZUy2rM3YyJDY9SHmh9YBVT191LvF1MmHQ8NmikGxrsOu7PMo5ZG7h8MyYaZAdavR76G46siCapRoKen17EmExj7cdmneLEBhPTnjml+Ez97/T+Eun8+3bSYL6UrFDBoYgofUNWiQEI2my7Uwe050w9YbniWtbM3xycnlRkp0/wY+EimUAVXz9QZxKRpURup+l58BTBtIMsv3WvoGcYVFHioj4qaoy4PvEm1y/8eqXBuNFxPwjx2IXTPGf3D3VDEXAdBofVGUrcL36frPFdseI/LI8iB6Oj1z3h6nWWLnWSBoA0uYi6tIrpP8pjPhxk08dHtVfH8mjCdEhuEAvDg9GnCoyVPKatgzL18aE2L+/fNDtYbBCMizIVFxpJ8Fl9GCz+vggWss5OYMMMVY67yb8wBEDV4pxyExwhIErCAGFim/UEC5CuchUNmqrC7+txnXY5ofx99/928BpMzlTKy/1ExR68Yh8OdiFIe3XLLmW7ssw74wSg3KDPZjHCaJiIsD0h9fhMcZWe3Nf9LC2BkGrPx5vUROxF3K9iVQpSLTsnzuw1DyLTaTrq5h2Xksm9a/UlGydF2tA/9Odbq2MlV4PiqvO2fBhGvRJzGC3f3YGevnUrJcO5WBt2p/kCWc3AoY6XnILwh9ETsFWAYvIuFPJbJZAd4/3nMS8beFz+rIQ5Pgdm94WHsnO6i4U8+sxPlXNV2vBtzu064P+kW8PvztdfUc4VKInUBnf977Y+Bj8mHSz2zPJpCnhSopZr8IGzAAJQwgu70651gwusQ2theHTzL16dlICEzCp3ddPtPgJJg5lnusK/cLO Kh5oQcDe nCXRBzwxAagkl97ezxcWpBxI2F/QtbmRglbsAS2Qpfe5xjvmNXXdWo05BSvjjey4M/pUPG5IdbbsMQ0MeFZpr3I7Kr0wcImlEuVY+5+ah5AsewIDVnbZ/PZHvSxwS54L9MLOTBu/8wYNVyZiSt/CrrjBlaVgDRzwj5qmkLARQQ1HPWUZynOYojRvrM7SFoaAGdnJghuYNcXr/HS2npBhVTz7IPSXd56Fpcy1XKiI19KDsyF+1I8WDof6DNCo/dK0XCn7B/Sj9TVKnB7k= 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: List-Subscribe: List-Unsubscribe: On Wed, Oct 23, 2024 at 08:18:35AM GMT, Lorenzo Stoakes wrote: > On Tue, Oct 22, 2024 at 05:53:00PM -0700, Shakeel Butt wrote: > > On Thu, Oct 17, 2024 at 10:05:50PM GMT, Lorenzo Stoakes wrote: > > > It is useful to be able to utilise the pidfd mechanism to reference the > > > current thread or process (from a userland point of view - thread group > > > leader from the kernel's point of view). > > > > > > Therefore introduce PIDFD_SELF_THREAD to refer to the current thread, and > > > PIDFD_SELF_THREAD_GROUP to refer to the current thread group leader. > > > > > > For convenience and to avoid confusion from userland's perspective we alias > > > these: > > > > > > * PIDFD_SELF is an alias for PIDFD_SELF_THREAD - This is nearly always what > > > the user will want to use, as they would find it surprising if for > > > instance fd's were unshared()'d and they wanted to invoke pidfd_getfd() > > > and that failed. > > > > > > * PIDFD_SELF_PROCESS is an alias for PIDFD_SELF_THREAD_GROUP - Most users > > > have no concept of thread groups or what a thread group leader is, and > > > from userland's perspective and nomenclature this is what userland > > > considers to be a process. > > > > Should users use PIDFD_SELF_PROCESS in process_madvise() for self > > madvise() (once the support is added)? > > You can use either it will make no difference as both will get you to > current->mm which has to be shared. So I'd go with PIDFD_SELF for brevity > :) > > This series and the prerequisites I already added to process_madvise() > already provide support so with this in you can just use this for that. Thanks a lot, this is awesome. Is the plan for this series to go through mm-tree or through Christian?