Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp378938rwo; Fri, 21 Jul 2023 13:24:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlHHcldskvLLxY4tZugGXl2CZN9/EReClC/s05gQdNphD2NccLJwlgZiXgVgQVMqXfmuuiaY X-Received: by 2002:a17:907:7758:b0:988:a578:4d65 with SMTP id kx24-20020a170907775800b00988a5784d65mr2521441ejc.32.1689971097361; Fri, 21 Jul 2023 13:24:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689971097; cv=pass; d=google.com; s=arc-20160816; b=rlNI+MChgECiKhydSVVzi9avymGGXwqacw4fgaojck1JqqUuKKpoltzD4fjG8+ZGtK Ri98CGrd7tXvijuS0wmqiOUn3FN2lyN+sxEqI5lQGzHPEqnTR84F1V14a5Uxynbcy9H7 MzP8PCvifYXHBK0rQzlETEIJayHM9z14mbjoRULBgDtq8xHIY9Tl1tibWrCHZRNgHgKX 8oDuXrr9w5YO+NOJeXMhpOm2dQITgyFnok8TdmMMUU7kI5p4xupwJFM3i8ewNGFMhIsk 3ghrZo7qkPBgDQTIGMCCx7VMl0g7EbTm1YV2v6UBU8WPY6BQVRfoi9cFOuJiL/nde3FR cz7Q== 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-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vIYcMjMB89RrpnGUWuO9Bth+BVt5VDFDPmN0FhnTf6U=; fh=QWwVpHMKqLYugtHeafQP6N9UQtiBWc12V2vqkiTwEPs=; b=zxfRffMfOT9xGyVSEupQl+8+RpwBDJal4IrCZCLOzctVx+nubn2A4b8IYWfw0pNCKq DKEGBOxR+fo2Kboys1yMv4ANLmGuJ1JHC0PXyviJb+36EzvcHgBk8hrgIGhO32lnC5EI BQAOGjkJ8f6gK4/lMD1CA4OxxzlVACEGawfqRk1H2q2h+HIxZNBIz4U/sMs3fDWeaFAw 2lsG+U6rpBFcORABZ7IRdbjpzsEOTzr6cRcOgrsLkoZ87kQivRQEv2NbHGr5ZHJzIHiK KR6RDOyoYjnDTVFNCZA/kZ8EGP/TLoMhKUvZMv920B+7+Qde1YP6b0YeA3rw27owfPkl yHiA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=HfC0+oZw; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m12-20020a1709060d8c00b0098935e138basi2474123eji.286.2023.07.21.13.24.31; Fri, 21 Jul 2023 13:24:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=HfC0+oZw; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbjGUSqo (ORCPT + 99 others); Fri, 21 Jul 2023 14:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjGUSqm (ORCPT ); Fri, 21 Jul 2023 14:46:42 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2084.outbound.protection.outlook.com [40.107.237.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ACCB19AD; Fri, 21 Jul 2023 11:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FZUckInf85/TasFil2nxD3wIOFhSIqfuAVCwcb2ZCIsKUhXn8gtlx4+tXNRSYOljs9Md2iYc9BWN6QmzNeQxLGXP0BIu8UXLHfQ9uwnoNmANwH2KO0YEC6p71mHnqR96fEfh3jHtvwKmthVJBGijgCYCcMXDZ8+sPYkKAwdfz/FFe9PbXyWvHRh8ENaPfEgetyiy1iI2aFe5z/75HWvvw21+mw9BRyf6KaTjLKcsUOLH5S5upV0qNCt2Epzni3u4AdY4Uw8n/Ms8RoQlEAB9pD1GtFVeNPSvhU+hcgXyF78AuqWO+eimnK7OuRpNsRk5Fu7zQeznxMbR1ScxmQq0BQ== 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=vIYcMjMB89RrpnGUWuO9Bth+BVt5VDFDPmN0FhnTf6U=; b=jlgXBS9gwfxo+ZPrGHKMTaHSgYEz7XEBLabk9xhqx8SwLWuQK9/dAX8IuIIo7Sfi4JK3HrXbs+UDc5wkcKNBvp7KhM7mGaGgx1Ge87/hAKB9lbxzRlg/bKVruNr9V9lq1xRWK43JphynvHpqpxi5MUQkFetYCrkIMUpTNBBMKIoECLLGkUx+ZaTLPgi3PMajnMvimpE0HxywQbKXeva1S1mIbox/ohElFIZELL9BxLzHXMfsKVjxX7lGFr7vrnS1v8ILVpfGAcl9AxFPi7d3uUeTg0wBN2241t1Ypr65TnJfb08nuZ9T7ADG9s+4qt37orWUBIRgJwP8SNzxuEWhdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vIYcMjMB89RrpnGUWuO9Bth+BVt5VDFDPmN0FhnTf6U=; b=HfC0+oZw956QcssOksnyM4iV7TA0KQwShlHjL/brmX5ut5wqD9e/G511mEIgMxJftpYnsZ913RtBpx/lZHSR2FWUWt0qM2+xHdtV9Rl6rMJVv85g+DGlGX4Bgkj5yAgbL/EK9yho0WT9pTLKdgYyxtRHGyc6Kp+FuA9AvkgqABw5Xw+X73cSitaIZgzBUuCdaZh5RBaHg4pJRexmIpVKy7UzPdPFI3uLeJamrkZrveGqeskJ+aoWW8g86S6O9CZM8v1U/uViL/u6Jo0rVDsim9cfVtrukzpVGdKsurjv8o3uZXpOV6eiFDT8jkb5Kd55OajT2+di2V21qEmOLC5BLQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by DM4PR12MB7646.namprd12.prod.outlook.com (2603:10b6:8:106::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Fri, 21 Jul 2023 18:46:39 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::5111:16e8:5afe:1da1]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::5111:16e8:5afe:1da1%6]) with mapi id 15.20.6609.025; Fri, 21 Jul 2023 18:46:39 +0000 Date: Fri, 21 Jul 2023 15:46:37 -0300 From: Jason Gunthorpe To: "Daisuke Matsuda (Fujitsu)" Cc: "linux-rdma@vger.kernel.org" , "leonro@nvidia.com" , "zyjzyj2000@gmail.com" , "linux-kernel@vger.kernel.org" , "rpearsonhpe@gmail.com" , "Xiao Yang (Fujitsu)" , "Zhijian Li (Fujitsu)" , "Yasunori Gotou (Fujitsu)" Subject: Re: [PATCH for-next v5 5/7] RDMA/rxe: Allow registering MRs for On-Demand Paging Message-ID: References: <7d8595c23e954e0fdc19b14e95da13ceef2adafd.1684397037.git.matsuda-daisuke@fujitsu.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: SJ0PR03CA0227.namprd03.prod.outlook.com (2603:10b6:a03:39f::22) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|DM4PR12MB7646:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d38d078-3457-46c5-9a62-08db8a1ad199 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WED5mJ7rTIucrpVIKEBioIAuDX2IULB+3zrnFfJ8dQZiQD4jZ29TV5ennDqVv29Lv2DMsrRojoVIxlEDghxk/6PBsMkAPQi5LEFIi8ONGVvMygyXntN11Ed9ZOxkBp38dbzvLSzcNVkv6iLXm7vn9SGK5HwQiknbIkOUroJMAvoPyihyOBBMyPyL4M9dnhLzPaDNvpvW9NoXG7mXeYmhExOv5nk/DgXR8fC5fcGWVYWUAohYm2b1sqkrjpFJ9tqhMokThS9/gX4TLUZkeYaoNziYADPTjKh6mO1T3TZqO5/A0dkt3DI+EpeQOKGFewHwKBCX3WgmOwxbUWtMGs7yrLSesjTPPbuvTjyP7aUW6ZFLtF11YkdF7DvHGdjT41cf5tm8SUbYJiK41JaRDGHyHVi00ZwrtZYdaraDl3phECw5HF7EwGdnPdVoEeWw4WKyvfgaJpfQEY5hffwREkdI3MUDvpd81dz5axzRTF3xZ3q8wbp/HLyoCd7YerdED3Ps7dbeDGFDqdAfJJbNDVRBjy99EIejoKThlBwq8oNuL/YDEgRIxAQkg8Jck5wwFhWD X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(366004)(136003)(39860400002)(376002)(346002)(451199021)(54906003)(66556008)(6486002)(478600001)(36756003)(6512007)(5660300002)(2616005)(186003)(6506007)(38100700002)(41300700001)(66476007)(66946007)(8676002)(4326008)(6916009)(316002)(26005)(8936002)(83380400001)(86362001)(53546011)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?2V15vbVxMnBM3Hx360gEYVxcA72bWxdA073sE6KT8Ti0ZJHBpODGH8ksF/QN?= =?us-ascii?Q?MCNLsM+q4OpTyjnVonC9Rch5dAUHpI2eKnTHJItby44dOfRKJ2yOa72n/D8e?= =?us-ascii?Q?VnkTMXZqkRWbS2JcNYk63JPPR5ZT+wuhsAK1Sx3EX+kwZ0KJe9A7GWqMYkwG?= =?us-ascii?Q?sSaJI5g8+UhLkGo342slvKyoQyTaTAxWHno0O7ZD41lSoSyvZ3/TcFrdq8AJ?= =?us-ascii?Q?RJfN3mWBlQkDzCuoPQipv22hVwZdI8z52x4jSK4/LG/CeDJJ+yuC19ernsIL?= =?us-ascii?Q?yv8dZSmlgzevnDyICut9Nr1XYcclrRjpDBwXMpOOMT32QfZRNVqWknyRWME5?= =?us-ascii?Q?2yue+TNP1IC/DeT7Wq4uOB8Q9r4HKv3wtli0BHs/79ymD2JY2v9/dx8lynRO?= =?us-ascii?Q?WKSkKAtAavp5hCH+dESvJcg7C5wjep1vs4I6RwZ1CuXyJCqMF5FVYaEfO1Uz?= =?us-ascii?Q?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rNN6?= =?us-ascii?Q?NurG7bTmHH6lLQHYqQfJY05/AV1kNoogYrYCE7SoOiQ9Fzrd1fRZQ3Yqxl7p?= =?us-ascii?Q?CbjLZaUvc/gE3bTS1GXYmIo1i9i4Zfr6BTjI3ceTloK9piDrqwMCqqtjvV0O?= =?us-ascii?Q?72s1T0zaoIEjuds7sBOZWxHoYeEEdEip2a43iM4rvw8PpDxwoWXsl4eWZ6IJ?= =?us-ascii?Q?AE5NngziJPt+JMDYfhtCxHR1Hz3axa84YsLvAJmJ?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d38d078-3457-46c5-9a62-08db8a1ad199 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 18:46:39.5163 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1yIK1JRw6C/IYzWX6vm6eyHUWxviKauwYBk75Met7/81Y4aC6dWANwUfZ1GQgeST X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7646 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 On Wed, Jul 19, 2023 at 06:00:50AM +0000, Daisuke Matsuda (Fujitsu) wrote: > On Tue, June 13, 2023 1:19 AM Jason Gunthorpe wrote: > > Sorry for my long silence. > I must spend most of my time for other works these days, > but I am still willing to complete this and subsequent works. > > > > > On Thu, May 18, 2023 at 05:21:50PM +0900, Daisuke Matsuda wrote: > > > > > +static void rxe_mr_set_xarray(struct rxe_mr *mr, unsigned long start, > > > + unsigned long end, unsigned long *pfn_list) > > > +{ > > > + unsigned long lower, upper, idx; > > > + struct page *page; > > > + > > > + lower = rxe_mr_iova_to_index(mr, start); > > > + upper = rxe_mr_iova_to_index(mr, end); > > > + > > > + /* make pages visible in xarray. no sleep while taking the lock */ > > > + spin_lock(&mr->page_list.xa_lock); > > > + for (idx = lower; idx <= upper; idx++) { > > > + page = hmm_pfn_to_page(pfn_list[idx]); > > > + __xa_store(&mr->page_list, idx, page, GFP_ATOMIC); > > > > All of these loops can be performance improved a lot by using xas > > loops > > Well, do you mean I should use 'xas_for_each()' here? > That is the same 'for-loop' after all, so performance may not be improved. > Additionally, the 'idx' value above must be counted separately in that case. xa_store is O(n log(n)), xas_store()/xas_next() more like O(n) per store operation. Jason