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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 0943EC433E1 for ; Wed, 19 Aug 2020 11:19:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCEEC206DA for ; Wed, 19 Aug 2020 11:19:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PqH95VsK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727972AbgHSLTI (ORCPT ); Wed, 19 Aug 2020 07:19:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727807AbgHSLTB (ORCPT ); Wed, 19 Aug 2020 07:19:01 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13242C061757; Wed, 19 Aug 2020 04:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=S3ViV7VOxKoiTfVgrvw4ZTEB3xmhm4rVfkGYugjh9Xc=; b=PqH95VsKVPNJwI5a/Er+qYg1YE 2cP0Ceuh2EDSbznFUi6KCJU7M7Tnu1YxtinWU5IogRZ5X49Svh2ING9dG/X8+rguc0s8CNSZJSVjz sraZ7CGNbsDhWzRg8+UC6yH+tcPq9EXMZaDIgh2vnz9pMYTUAJGAn4dbA7FDtXtyG0dgROnOxjecF HOVDUZCBr76yq9h8gCFemMaMo2+mPHghmOxYz2YkVf+ANSqWMa0srF34jYala3pRYzPD19EoNJfdq Ood3xlpgoQ1+iBy6EacDpMR9Obz0ZXPuj8jDYzWyRwFWRGHSlTe43zBy51TCIlPCVr09ikGje2dIK +jtFq6ig==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8M7H-00015G-Od; Wed, 19 Aug 2020 11:18:51 +0000 Date: Wed, 19 Aug 2020 12:18:51 +0100 From: Matthew Wilcox To: Christian Brauner Cc: peterz@infradead.org, Christoph Hewllig , linux-kernel@vger.kernel.org, Linus Torvalds , linux-arch@vger.kernel.org, Jonathan Corbet , Yoshinori Sato , Tony Luck , Fenghua Yu , Geert Uytterhoeven , Ley Foon Tan , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Arnd Bergmann , Steven Rostedt , Stafford Horne , Kars de Jong , Kees Cook , Greentime Hu , "Eric W. Biederman" , Mauro Carvalho Chehab , Alexandre Chartre , Masami Hiramatsu , Tom Zanussi , Xiao Yang , linux-doc@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, sparclinux@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 00/11] Introduce kernel_clone(), kill _do_fork() Message-ID: <20200819111851.GY17456@casper.infradead.org> References: <20200818173411.404104-1-christian.brauner@ubuntu.com> <20200818174447.GV17456@casper.infradead.org> <20200819074340.GW2674@hirez.programming.kicks-ass.net> <20200819084556.im5zfpm2iquzvzws@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819084556.im5zfpm2iquzvzws@wittgenstein> Sender: linux-arch-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Wed, Aug 19, 2020 at 10:45:56AM +0200, Christian Brauner wrote: > On Wed, Aug 19, 2020 at 09:43:40AM +0200, peterz@infradead.org wrote: > > On Tue, Aug 18, 2020 at 06:44:47PM +0100, Matthew Wilcox wrote: > > > On Tue, Aug 18, 2020 at 07:34:00PM +0200, Christian Brauner wrote: > > > > The only remaining function callable outside of kernel/fork.c is > > > > _do_fork(). It doesn't really follow the naming of kernel-internal > > > > syscall helpers as Christoph righly pointed out. Switch all callers and > > > > references to kernel_clone() and remove _do_fork() once and for all. > > > > > > My only concern is around return type. long, int, pid_t ... can we > > > choose one and stick to it? pid_t is probably the right return type > > > within the kernel, despite the return type of clone3(). It'll save us > > > some work if we ever go through the hassle of growing pid_t beyond 31-bit. > > > > We have at least the futex ABI restricting PID space to 30 bits. > > Ok, looking into kernel/futex.c I see > > pid_t pid = uval & FUTEX_TID_MASK; > > which is probably what this referes to and /proc/sys/kernel/threads-max > is restricted to FUTEX_TID_MASK. > > Afaict, that doesn't block switching kernel_clone() to return pid_t. It > can't create anything > FUTEX_TID_MASK anyway without yelling EAGAIN at > userspace. But it means that _if_ we were to change the size of pid_t > we'd likely need a new futex API. Yes, there would be a lot of work to do to increase the size of pid_t. I'd just like to not do anything to make that harder _now_. Stick to using pid_t within the kernel.