Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp819379rdg; Fri, 13 Oct 2023 01:57:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0jAQQY1pWwbQL1FTXIDm92xhrES88QYEoHqS/f96fwdGYlftMKkpJNIZQqZr5VuwnUAGC X-Received: by 2002:a25:3496:0:b0:d9a:c1c7:3729 with SMTP id b144-20020a253496000000b00d9ac1c73729mr4142705yba.25.1697187441259; Fri, 13 Oct 2023 01:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187441; cv=none; d=google.com; s=arc-20160816; b=GMgilGI5ccaB+t0/rSMXvfn3SJX5VcN1imHF6owWUduS/2L6g8JrFOcUR6lRUpGyE9 djy09j1baO7eybHdY/Su1CODCeisnfHTbgiVa5z2I66WTV8unCGveUpFkY6ohUvleDE2 sYUWhJLWmscOqgbQ5B4C1+e7eJWYC3h1RSNku5LKlNybBj8S4DahD7K2bPTR64EHRcUY QyA6dcq7cpS47/yTneZ+r65wCGQkcf7DdxworbZYrovN25iBGYIpHTROdgFFPvUKIo0n F28lSxnz37pWzydSNY6mSIssw1nv8dUTbNbP4ldzgsOKT5pw2Je50No2+MOvM7uQ35co Tn3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=QsJhIfLsRHiX///0/Oi95cVwlqVzdrWiGNekq6xdLM4=; fh=ar1K26G0FMZoSMAiAaLVKwRkqwi6WSauIE31IKnOy+s=; b=iAQjmTJlowf/D2IOn8MgxMC1boDWMCuyCkU3KnGP9bIpjoNdiI4gDSuxINtGGIkeOh 7ddiM2L4H34Pxjggj56PDsidM/3rHN8Yo4BIRq0j+vGHzFkQaqW8WAoTzxIbpAFm/y62 ptFhW5RcFcz/IlV1tZm81IPQG124hyZnVDSrI9Q+nW5jcXq8ckzavvwLVWnKekCj4oxA 5JXWUtSbQAqhnugPiWaovQG98PrSPVjn/NTzM5AXslhpPTQba4Q/pb9jF+P9Qb14jmm1 uURIH/F7bXMM65G83yhOAq3e0FTF52snS4IwRQVb6ljTByiSnGRD5+SXRx+hCQ32V2Tw kEsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=BYG5qh2e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y9-20020a056a001c8900b00690d25b198dsi16193860pfw.103.2023.10.13.01.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=BYG5qh2e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9034180A7E56; Fri, 13 Oct 2023 01:56:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230259AbjJMI4h (ORCPT + 99 others); Fri, 13 Oct 2023 04:56:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230193AbjJMI4d (ORCPT ); Fri, 13 Oct 2023 04:56:33 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CF11B7 for ; Fri, 13 Oct 2023 01:56:11 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-323168869daso1769629f8f.2 for ; Fri, 13 Oct 2023 01:56:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1697187370; x=1697792170; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QsJhIfLsRHiX///0/Oi95cVwlqVzdrWiGNekq6xdLM4=; b=BYG5qh2eo4/zFD42uLqrvuOdI60clKmsBhB4WBRIaqJiLXC/r6pLzta0eBLNtulfl7 hop0gta9A7Xnq2hI9NxWq2fYN3qcPu5jUW2YpmYc74Ok9rO338RmGmgNP8gWwjuT7m18 QyUJAPtY0toRxvdtEnc27noXGMX0/jazvRHv5PF8TsrQRiHpTOtFmxKUza2JB28+za9W RRGpa+iJ99f0K0nm/bku1lz52eY6q1Qw9OoVj/gmv6+rZTtVOVUsnZtKW/BHICTIPhZB ZWrVfQ+Z8hJpMHMnmpBzq6tl4TxS3XtKSIaDDMNNu/kUnNYG32LLE+WoiFetJGaucJOp MJFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697187370; x=1697792170; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QsJhIfLsRHiX///0/Oi95cVwlqVzdrWiGNekq6xdLM4=; b=Vo4S+nnc6wNvS/SqAxge8qMHg7gus4JOBRQ63Rv34vof5Q2nzuRA8Iptflq9KKW+RV XHPP+tsFlBDhpiyrM/MNG4zBv9LTagMGiI2hAIcDWIGQFeXkjw/PNpnL6OKdywyT4mmy BfCQMRHdTwwGesbVNwJWyIbDUMnOLBchhBJzKrJr/apOfikClW57jY2UMUTmIalrmJiY UHym9nEXiuWwF9GAxd9Inpofj5Uz1pTNH/LXACdWobzH6u1qy0mXAzdHgdCdkVeBZpIx cyxIYBQyeoh4NVq9v3hnKrM68k06izaxV7cK7GSrrGLyiZdILKq7CtxxWaYDzwIZL43z s5xQ== X-Gm-Message-State: AOJu0YwL7XzN9o/6I8URPBDdIkCiiEUH8lpt/7J8I2Tn26UADfQtvx2v PPzc38KXPFl+mLtYA2GFUuzCNsgIwWufbnkqvOS1UA== X-Received: by 2002:a5d:4b05:0:b0:32d:8db5:59ff with SMTP id v5-20020a5d4b05000000b0032d8db559ffmr3673791wrq.5.1697187369658; Fri, 13 Oct 2023 01:56:09 -0700 (PDT) MIME-Version: 1.0 References: <20231011065446.53034-1-cuiyunhui@bytedance.com> <87sf6gcyb3.fsf@email.froward.int.ebiederm.org> In-Reply-To: From: yunhui cui Date: Fri, 13 Oct 2023 16:55:58 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] pid_ns: support pidns switching between sibling To: "Eric W. Biederman" Cc: akpm@linux-foundation.org, keescook@chromium.org, brauner@kernel.org, jeffxu@google.com, frederic@kernel.org, mcgrof@kernel.org, cyphar@cyphar.com, rongtao@cestc.cn, linux-kernel@vger.kernel.org, Linux Containers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:56:43 -0700 (PDT) Hi Eric, On Fri, Oct 13, 2023 at 10:44=E2=80=AFAM yunhui cui wrote: > > Hi Eric, > > On Thu, Oct 12, 2023 at 11:31=E2=80=AFAM Eric W. Biederman > wrote: > > > > Yunhui Cui writes: > > > > > In the scenario of container acceleration, > > > > What is container acceleration? > > > > Are you perhaps performing what is essentially checkpoint/restart > > from one set of processes to a new set of processes so you can > > get a container starting faster? > Yeah, you are right . > > > > > > when a target pstree is cloned from a temp pstree, we hope that the > > > cloned process is inherently in the target's pid namespace. > > > > I am having a hard time figuring out what you are saying here. > > I think I need to describe in detail our needs and problems we face. > What we need to do is fork a container into a new container, which > means that all > processes of the original container need to be forked out and added to > the new container. > Then the forked process needs to be added to the namespace and cgroup > of the new container. > > What we are talking about here is the pid namespace. > > for example: > Assume that there are three processes A, B, and C in the original contain= er. > What we need to do is A fork A_new, B fork B_new, C fork C_new. > > However, in the existing pidns implementation, the parent process > first joins pidns, and then > the forked child process will get the new pidns (the pid of the child > process is what we expected), > and the parent process's own pidns has not actually changed (at least > pid is still existing). > > To make A_new, B_new, and C_new inherently in the pidns of the new contai= ner, > A, B, and C must first switch to the pidns of the new container, right? > From my understanding there is no better way to implement it. > > But the existing implementation (the part to be changed in this patch) > is blocking our progress. > > > > > > Examples of what we expected: > > > > > > /* switch to target ns first. */ > > > setns(target_ns, CLONE_NEWPID); > > ^-------- Is this the line that fails for you? Yes, it failed here. Thanks, Yunhui