Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1419909rdh; Fri, 24 Nov 2023 12:09:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDRtqDk8G6nfYyFsWYh83sQ2Kx42ujzbW/7A0wHD4O+XCVtNMopqAtQQvilvvxVVOUCosw X-Received: by 2002:a17:90b:4d10:b0:27d:5964:4eec with SMTP id mw16-20020a17090b4d1000b0027d59644eecmr4389682pjb.1.1700856584804; Fri, 24 Nov 2023 12:09:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700856584; cv=pass; d=google.com; s=arc-20160816; b=Matw+ADMRjCp68iMdBRl6kuY7eqHXN78ctt/3fPeCwGODgAIBlklms8O0swSCXR0RW /kPuzh/39kBFCKtxVR4xKrGJDxP6QaaWzAYrdqXjFjWc83vnxQ3/wVw/4Ja9p+8qLZbn E66IT/gwdLaDMlQICkIW+QsL5mIT2RO1LLKqwG27qu0dV8ciujcKJK4+HBdCgUZXmgTH L3B532dH+foCIGZjzCesJbRT6e1f/sCaWiP2uBl0JQlA+yqHgHfEH2QwifrLLqz4jL2I H0kCa9afGWEwUqTEVdcHS/eEdW2nqNkkNDhW7gqQRLru2tJbzuqf2M7kEoz641SyT3EV P+CQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to :content-transfer-encoding:content-disposition:references:message-id :subject:cc:to:from:date:dkim-signature; bh=6BtI0TpVkzYXF2pMkcuqVzyty6IMkzzIOovbyYxJHek=; fh=zLGnflD/NoHdNpBFVVJlX4GR2vSu/6/Tztkfo17+vYI=; b=wQwt6BkRWwWungwdYuWTTuO00b+wy8WuCklySwOkw7mMZ+iBdtVPtqvq0I6E0XXcYw Axh9UVw5PFkOyfBiqN+ErU2N6aRHk9v77N/Gk5NHNl9m4S5wuwG4OAyjxsdCjikJyWeh VlP+TKi+K8FJUq0PDaz7OLs+ITM2DeTBVKbZMqj78cxjvK4+ZMcxJvOH4sdaYQ1M8BqM rK99fgG3ejWLGX9osxSW1R9dgne/sN5BSeJTgsTy5AXksuVYaYznXbSoSCPr3J+wJI+T tbu5InGpxXLW/L7YZIh64qWEvW27DPiqjM83Q8KB0spB123y0LMFRkQlNS/EsJYa0sOo nt6g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@memverge.com header.s=selector2 header.b=GdlzfkCS; arc=pass (i=1 spf=pass spfdomain=memverge.com dkim=pass dkdomain=memverge.com dmarc=pass fromdomain=memverge.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=memverge.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id s2-20020a17090ad48200b002803c462793si4662585pju.152.2023.11.24.12.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 12:09:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@memverge.com header.s=selector2 header.b=GdlzfkCS; arc=pass (i=1 spf=pass spfdomain=memverge.com dkim=pass dkdomain=memverge.com dmarc=pass fromdomain=memverge.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=memverge.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2C02081D2D2A; Fri, 24 Nov 2023 12:09:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346044AbjKXUJ1 (ORCPT + 99 others); Fri, 24 Nov 2023 15:09:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232591AbjKXUJ0 (ORCPT ); Fri, 24 Nov 2023 15:09:26 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2056.outbound.protection.outlook.com [40.107.93.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2303D41; Fri, 24 Nov 2023 12:09:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i9Kai5ty4bEwa1Wx9Gh+W6KSJUxSg1v9Zhl1sBE9UFePCaU367EXwwa9ZkhToBRjvjiUNWKOSKRa/S7C1/m979RWQpQaIAOhT2A8wdVR/s4HJ8uiD1/63P0MQa8018nF7y1JZs/Hy0gLg/ZsvZ/z8sG5xrabqYIeQUR/QT+2v8GEE2BqxNcN6/B2bu5ZNEAF2FEyJZv2Au2BOUObWKifD5KkR0i8WUPP/x9N0Yhpg/mM+Rd4CfjdPssKlHl8zxq/kC4IckNQCTghmjhO4BO3fZlc94Xroze0sLtw/1KJsxdbjR1h/HmQwiEfyrrv1E9nP/cwri/KNJyEMLWk2yBBog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6BtI0TpVkzYXF2pMkcuqVzyty6IMkzzIOovbyYxJHek=; b=kqIuXJOMr8XjyL7R5Keibljwe3QN0YsOxj1tcRklX52EW1zIkuGbqn/02hTxSqDNj5wThUcMnK3omZCllOuU75GrarsPTiBmCBred4O46nXslqzLwMb9brRnqyBLy/8Uu04OanZ5xYCQfOCivrOE4gzX4jjBFt/e9iI+YMemfSmXqh3Pv/rUNjhlk/NuMk9FGr4ioXJAky3IhuJh8wurI8mN1N9bxAk25DbstnzOZJOcobeotBUuFudM1+dlaAp/a/mYu2fwHmkUFHhVyBRLIcxYSUvAjb0Fg5d15YBZf8hmW5g0fOsKOQcNAKT2tDNC4Xk//O4HSMa5eIHVNtoq3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=memverge.com; dmarc=pass action=none header.from=memverge.com; dkim=pass header.d=memverge.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=memverge.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6BtI0TpVkzYXF2pMkcuqVzyty6IMkzzIOovbyYxJHek=; b=GdlzfkCSNqn4VmQCHg39tWGQuKehiznxQ3EUSPXpEeT1KbjXK1l9sPhf4kSWGTPn1BKxsFg5yFSDiSzaJAGwC5X5FejUxedXRdObbLfBaFMwNthEgJk9xOuzR1FITGMPNvVnXH4mzhJrT33krAephs/3m4sdJ0y7YoIzDMeH+a4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=memverge.com; Received: from SJ0PR17MB5512.namprd17.prod.outlook.com (2603:10b6:a03:394::19) by MW4PR17MB4275.namprd17.prod.outlook.com (2603:10b6:303:77::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.14; Fri, 24 Nov 2023 20:09:27 +0000 Received: from SJ0PR17MB5512.namprd17.prod.outlook.com ([fe80::381c:7f11:1028:15f4]) by SJ0PR17MB5512.namprd17.prod.outlook.com ([fe80::381c:7f11:1028:15f4%5]) with mapi id 15.20.7046.012; Fri, 24 Nov 2023 20:09:26 +0000 Date: Thu, 23 Nov 2023 16:42:32 -0500 From: Gregory Price To: Zhongkun He 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 Subject: Re: [RFC PATCH] mm/mbind: Introduce process_mbind() syscall for external memory binding Message-ID: References: Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: BYAPR07CA0097.namprd07.prod.outlook.com (2603:10b6:a03:12b::38) To SJ0PR17MB5512.namprd17.prod.outlook.com (2603:10b6:a03:394::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR17MB5512:EE_|MW4PR17MB4275:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d933315-8f19-4ee8-a74f-08dbed294245 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y6jumfXB7ypYkTt8Xc6tszyAquRGYPBRPTg+HxNiFROFC2YVWHhdO7lufaUFeCuW+Z8EI43b+XCNtvNH0jj2hw7vrK/ix/o58j5ORGjm5GoFO/cva0MXipx7XVFrW1FnRPR0QvPd0nZr4Xoo72bR7XrsKnlj0/IgnQzEV4gXeQE+n2Gu4DdSGwYczb7QFDBOt8a5TesoHUJB4ge2kS8nph+11jKkz0xEbU4Hrn8hsWT8Mj2nsfPWOaFZMiu+FRu9z6s8oio7T04ZGtSmfHaU5IK093VaQz0f0/52ebx6OqxzDlRL6l1DA/r2GJ97azx1LzCNJaYTg/aiRgo1qEeCdg0cK++CwfBeGaCUZe6Yk8rD6FBp4SICIwJgz+G0iYVnckqQqR5CyKwHHW3sQ9Y/CFCXPQY5mlSIGwmh6c2CYweE0MUZtCcVvpVhDwcWwzWW77fI7dTxbcbqyktJ2Ho19lnghvAEKTnUN+JtGVA/ZMe2P2hkNMm7mI+E1R+wfQXbKiY096pAZAaYp9LP6S4nlYfNEQo0gJbbnyj6pKRJCG3I3/LxuQrAK40/hkyzcOpn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR17MB5512.namprd17.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(346002)(396003)(376002)(39840400004)(230922051799003)(186009)(1800799012)(451199024)(64100799003)(83380400001)(26005)(66556008)(66476007)(66946007)(38100700002)(2906002)(7416002)(4744005)(6916009)(316002)(8936002)(8676002)(4326008)(5660300002)(44832011)(6486002)(478600001)(66899024)(36756003)(2616005)(41300700001)(6512007)(6666004)(86362001)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VWR6ZC93T1ltN2ZheVZkenNXNlQwNXZSNDRWN2xGMm9IUHdSWVBKTXZCcnph?= =?utf-8?B?TDV2VzR0ZGJaZlF2OE15Z2hTdlovZnhsREpaUE80dWVWMWRnV0dGT0QwdnRj?= =?utf-8?B?am90ZHFtRDU2TWcvK1Q4amxLeHdjaFlFQzRybFZFclBrMjVPZGVvblcwR2xq?= =?utf-8?B?eHR1L1FmckFXN2krdGVWRkVpVERpUXRxYklWZFk0bWYxWGJwMmJRZlBWWHp1?= =?utf-8?B?UGxKL0g1TnFTNUVNVE41MVRkaVF0VVQwaU1NTU9UUE8vNDgzMGowaE40UnFL?= =?utf-8?B?VWJlSHJ5MkxHZmF4NzFrS1hTcytNclFlbFI3UWhZV2dVd0RuRnVrSkJoRS9v?= =?utf-8?B?cHh4NTJ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G1md2dFUUlKTkFDN1Bt?= =?utf-8?B?L0E9PQ==?= X-OriginatorOrg: memverge.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d933315-8f19-4ee8-a74f-08dbed294245 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR17MB5512.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2023 20:09:26.5672 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5c90cb59-37e7-4c81-9c07-00473d5fb682 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wTm1IpVKJ+T0B1fNeGvqvhF2V/c2gJfirj0rIfVbueRWTmiVGMBeKaPFIUXfTfOhy/AIys6eMnIuzSG0dV5GZV6tJsbSqgW0gJQjZ/a3gBI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR17MB4275 X-Spam-Status: No, score=-0.1 required=5.0 tests=DATE_IN_PAST_12_24, 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 24 Nov 2023 12:09:42 -0800 (PST) On Fri, Nov 24, 2023 at 04:13:41PM +0800, Zhongkun He wrote: > > Per my understanding, the process_mbind() is implementable without > many difficult challenges, > since it is always protected by mm->mmap_lock. But task mempolicy does > not acquire any lock > in alloc_pages(). per-vma policies are protected by the mmap lock, while the task mempolicy is protected by the task lock on replacement, and task->mems_allowed (protected by task_lock). There is an update in my refactor tickets that enforces the acquisition of task_lock on mpol_set_nodemask, which prevents the need for alloc_pages to do anything else. That's not present in this patch. Basically mems_allowed deals with the majority of situations, and mmap_lock deals with per-vma mempolicy changes and migrations. ~Gregory