Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1045692rdb; Fri, 1 Dec 2023 05:53:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRJYpBujW9kM/OT27x0c/01rgdS36ul/w0BgnjEgrG3E2QR7MkPgo3sJxkF7Zqsk4PXhB2 X-Received: by 2002:a05:6870:8585:b0:1e9:9742:7dfd with SMTP id f5-20020a056870858500b001e997427dfdmr27242363oal.31.1701438838918; Fri, 01 Dec 2023 05:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701438838; cv=none; d=google.com; s=arc-20160816; b=f2ZHpzL+Es7Pret7tPbIm263hyap6fJdYK8CLOGdO/GTR1zA7hasWnRFTOp58AFOIS NIBuUSJxaSmy/g7TqhwQ4lC1MUCMbiWgF3IQGUylSXVaEffFRM/D9crDXvCaax1Zousl 9pikvs10boykTwW9kTCKpnao+6SZSfih+g+zyFNep/3jC3fMcOyo09qQX5qDFEIMUY8N hIMNP8MZudrNLgIML+gaQmX+PFh1VKF6bCye9Y6zFMx7C/j+rdGx9uvSstQ8QYCT0iFW diwDJGTGrca/pBT0uh+SKRjpLxfsvAApQ1C0wWIo3u3PlQ00ZQ8EvWTEGjh+3QZHNUcl ecsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=B2gDIyfWC+W4ytDLyZ1ApFFOSpObEoeppni2yotM7Sk=; fh=BWTcAtlc6ENuN85I63TNLSZ9twJFe4zDhmDJlVwyv+g=; b=YQIALsCj35rgwSRl0WnzAY1beR+DCtSumLv91Vk3NYW9MHhYaihnxVYHJdqmer3sFF bL74jACZckUtR4Wn0u+GniNPPgo5Cn2UkGRoF8Z/MUNmMM+IBegeipCVK1mPaNWXuIJL x6v52E7UBO1kGBBDhhMbkuGArqg4Nzhi07PxfW1RjrHoj5JjTOgYUTEtFV9/zlezBriG LQfYQp4nJyeqn6wMtqNUBnmcUgJg36rcbjhAWCTsk2QK0gU0g+tqe7AON4lAd60/shEb wN/2cuVnz2HE6goc8w+X/5q4vnOHrzia/m2m/yur5IWEZBykYnU5ka3NAAXGqETRHhS7 c/oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Yk573CjB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id qy1-20020a056871608100b001f954ac59e4si1274840oab.155.2023.12.01.05.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 05:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Yk573CjB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id C2E7A81C0CBF; Fri, 1 Dec 2023 05:53:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379071AbjLANxc (ORCPT + 99 others); Fri, 1 Dec 2023 08:53:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379044AbjLANxb (ORCPT ); Fri, 1 Dec 2023 08:53:31 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 059E110FC for ; Fri, 1 Dec 2023 05:53:36 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-50bd928b13cso1028059e87.2 for ; Fri, 01 Dec 2023 05:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1701438814; x=1702043614; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=B2gDIyfWC+W4ytDLyZ1ApFFOSpObEoeppni2yotM7Sk=; b=Yk573CjBNOA4iH35REuCAlz0xcvrPdhovdZ10G+9ct9/82MJ2VUkatWF5ob7pNDWHA quWrakx+4FF5/3XxvR9LtyfIDhm487E0vDDSXGnyFHtYI6mDH0TY6fk/h/3gmV1C23gR u+j36SCyGcOQ6ubn8/4hNrahVAFCc3S6xZJ7yYv2HkoAaRGWKI7xwDI1Farhm0gLIuG8 w0y0Ix375m7LdTFa20D2Cd7XERlNahb3EAJ9mSeSu3MSKb5MmvJJmbEikY+vNDgLL2E4 BwlqV0QaZcYNaGlMM5nWO8nalNRO1MUptzEi0wUC7rWJ8FgsQNWGbd3WwOgSVDDkcvIi cj6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701438814; x=1702043614; h=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=B2gDIyfWC+W4ytDLyZ1ApFFOSpObEoeppni2yotM7Sk=; b=cJBJcHWmJGFh148L47Em6B/xfk8c28JV7aG5+uGwZhxeC8WPhuYVw6QYylahwJ8Ycc RZJZc+hG1a5hWrtaf2dzlPV5SGEvZQAUqNoPj5c8lFlADTjTofq5FI6bZDNlpr3/4OE/ NNiBg0SzPStihzdECqSr8Xs9wXungb294NQge5lmQbTMl1n5jdaUGfJ7Lafj4NyquC4H iaIm/fJ2Ih5A1A2LqiQjT0vkOpTlnc1HA+PvdPnoJ3TxSGYGbjvoLcLFgdTKcyy5H9Ru YcZDcZB6pnDprlP/jZIIlJhrXd4wgWmx0OSG6cFwrdmYLC8vwrN6vF+IwHVwthjShlyC JevQ== X-Gm-Message-State: AOJu0Yw6a7VslHeF4To6VOrn7NOh20cGHJ9x+zO3hJOZEjXN2+DVTZRf pPtzAFHLVOg+2/HDveQ47+6VxIxAqacIYd6/3YAU4w== X-Received: by 2002:a2e:8783:0:b0:2c9:c22e:31eb with SMTP id n3-20020a2e8783000000b002c9c22e31ebmr611668lji.22.1701438814214; Fri, 01 Dec 2023 05:53:34 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Zhongkun He Date: Fri, 1 Dec 2023 21:53:23 +0800 Message-ID: Subject: Re: [RFC PATCH] mm/mbind: Introduce process_mbind() syscall for external memory binding To: Gregory Price Cc: Vinicius Petrucci , akpm@linux-foundation.org, linux-mm@vger.kernel.org, linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, minchan@kernel.org, dave.hansen@linux.intel.com, x86@kernel.org, Jonathan.Cameron@huawei.com, aneesh.kumar@linux.ibm.com, ying.huang@intel.com, dan.j.williams@intel.com, fvdl@google.com, surenb@google.com, rientjes@google.com, hannes@cmpxchg.org, mhocko@suse.com, Hasan.Maruf@amd.com, jgroves@micron.com, ravis.opensrc@micron.com, sthanneeru@micron.com, emirakhur@micron.com, vtavarespetr@micron.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 01 Dec 2023 05:53:55 -0800 (PST) > > Hi ZhongKun! > > I actually just sent out a more general RFC to mempolicy updates that > discuss this more completely: > > https://lore.kernel.org/linux-mm/ZWezcQk+BYEq%2FWiI@memverge.com/ > OK. > and another post on even more issues with pidfd modifications to vma > mempolicies: > > https://lore.kernel.org/linux-mm/ZWYsth2CtC4Ilvoz@memverge.com/ > > We may have to slow-walk the changes to vma policies due to there being > many more hidden accesses to (current) than expected. It's a rather > nasty rats nest of mempolicy-vma-cpusets-shmem callbacks that obscure > these current-task accesses, it will take time to work through. > Got it, thanks. It's more complicated than I thought. > As for hot-path reference counting - we may need to change the way > mempolicy is managed, possibly we could leverage RCU to manage mempolicy > references in the hot path, rather than using locks. In this scenario, > we would likely need to change the way the default policy is applied > (maybe not, I haven't fully explored it). > RCU may have a long time in the read-side critical section. We should probably replace the atomic_t refcnt with percpu_ref in mempolicy(also suggested by Michal), but refactoring work involves a lot of code. A simple way is to use task_work to release the mempolicy which may be used by alloc_pages(). But it doesn't have a direct result. > Do you have thoughts on this? Would very much like additional comments > before I go through the refactor work. > > Regards, > Gregory