Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5318029pxb; Sun, 6 Feb 2022 22:01:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwB3LtBWk7WUJeG5/mUrRWp5Nc3bPbvYpDNrqGcujCsK6pqT4q5EWXPlFHbMLjE17avdoEJ X-Received: by 2002:a17:906:fd4f:: with SMTP id wi15mr4638023ejb.728.1644213684924; Sun, 06 Feb 2022 22:01:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644213684; cv=none; d=google.com; s=arc-20160816; b=hR9x7EbXhi+/8unrAJ9XlmkitK2J9Y3gDUPOI6RcqNkz41ejiY4l3NXQOePFMRYG2n eQGdel0R2weRet0HNPKmhOR2TAEQAOBgy1jSngbCR7Oj7VQUMaRg3ErI2nDmSJ1iu5TX bi70L5gOvQT+VYeWSQ/UlXx9xcdtb+E6afLgVlxv8yxqbJPKKEeivMCl533aSKAGbtts eT/uzT4kEMlgl4EMbh6frtgSRnK8arAtKOMDe/3IjTjYqAA6VpkqLkZnXjkeS9rdKi9J dCRMEDwaUuZa63Vfbi1+2pXdz9MRbWmsBd5bo3WRlnWw0g6M+IPcSSeATwqbtW+UC4Vy iDJg== 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=9GDyjcpi8vHQ1agJqGTPZSuuudSAi9QTyQsSvsAWA4Y=; b=rcVXroIaoHNvrx/ujTLSnqkBTndJ9J05f2UEWBIozm/JVW+H092PcjDKf33JlsnHXB oGvstg+GKucutWQVLtTSfnxMnsZUktNGI18apOLImeXlfhd3TXhENCBTcUKyb9G+NZt7 ZsXhw4H+69WqGii8iYwi//Co5IFjyNmcPqgDammRVkmEGYFacvrC4qj2j+iO9MCOHE8s odQFdQTd4rMr9JvHZS6T4jgKOxm5ONDkdpgT69HrZZJkHP1rw2+HHIYBzMCz9jhP+uAr dNDTJBAoziGfmNtj7ixjpR10/zpHjDU7oxHwSn7fc+Hgj2DfOKUwJxRDsIMBRR5BiIQ7 eCOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20210112.gappssmtp.com header.s=20210112 header.b="MvBO/8hn"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa39si7377925ejc.693.2022.02.06.22.01.00; Sun, 06 Feb 2022 22:01:24 -0800 (PST) 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=@intel-com.20210112.gappssmtp.com header.s=20210112 header.b="MvBO/8hn"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378655AbiBEAUK (ORCPT + 99 others); Fri, 4 Feb 2022 19:20:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241262AbiBEAUJ (ORCPT ); Fri, 4 Feb 2022 19:20:09 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC0EDF8E3CA for ; Fri, 4 Feb 2022 16:20:07 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id d1so6463250plh.10 for ; Fri, 04 Feb 2022 16:20:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9GDyjcpi8vHQ1agJqGTPZSuuudSAi9QTyQsSvsAWA4Y=; b=MvBO/8hngqIcKHzGEnGS4QtxuvdFzrLeGWn2ecnLcqh4XYPJB9liEUjruIa3/Zk/4o LgRlwzm9pt5Z+gKKQdV/AyR6c7I86uMD6GJ8C4uc2/V4tvX8uo8vKY7WCoOWk+fpBXMi UBL5P8QARq7njELSs3IPB4jOJHDywMqRHLwukfmnjbGCVW+6olknVSzoW22wsY8K/1qi 77HeJOudnpcCdrFnBQitEFu5QtvGij0H1SlLYxyFVot1PuxgFN04PQcKeJ0orrK0Zemy 15xcdqGFdV6UhKVU4PYYCux9k/qaPMksSHvJbu0D/Xudu+8ik87PGzl3IEO84+USkiTt JG2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9GDyjcpi8vHQ1agJqGTPZSuuudSAi9QTyQsSvsAWA4Y=; b=JMEtrd2OoDAIabABpMlxw+6BAnxeGzSD8q7U5iQrDqDJSZfoDNVTYoG3eooOlMHGJI kPbgr4TxxOvR5KR7fOw05j2JWXuk6mdN/wk2wcTyFvuMbNIcZhFio415C5RR1qrB/lF3 uMEf4NfMiHluqF27NkkFNJcj81x2UFd+Oxp34MnNK09tx2bEDkRc4hgTEb9fWCqYqpFJ w/Cmuy2+TCSonwVO7dBhakp9cC4XyoNhzohNP9NxHyEKPTNA3nXLlWRxSuWvrIsMUoQQ CX8s07sBrPu7wig/D/Ygv/qQdVCfacBEet+geo84clTQ6U5g6fYTjVOCXv8Dd5bW87DA hqxg== X-Gm-Message-State: AOAM533rLG1cxwaaovkOJ0zuj5W5LpCaCQvN0UjYAHgfms548RIxd1kp j2FM/hr0ChNBUKZe9LAoCiNsRbxoYckbWBeWc05a6A== X-Received: by 2002:a17:902:bcca:: with SMTP id o10mr5806897pls.147.1644020406999; Fri, 04 Feb 2022 16:20:06 -0800 (PST) MIME-Version: 1.0 References: <20220127175505.851391-1-ira.weiny@intel.com> <20220127175505.851391-39-ira.weiny@intel.com> <20220205000953.GD785175@iweiny-DESK2.sc.intel.com> In-Reply-To: <20220205000953.GD785175@iweiny-DESK2.sc.intel.com> From: Dan Williams Date: Fri, 4 Feb 2022 16:19:56 -0800 Message-ID: Subject: Re: [PATCH V8 38/44] memremap_pages: Define pgmap_mk_{readwrite|noaccess}() calls To: Ira Weiny Cc: Dave Hansen , "H. Peter Anvin" , Fenghua Yu , Rick Edgecombe , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 On Fri, Feb 4, 2022 at 4:10 PM Ira Weiny wrote: > > On Fri, Feb 04, 2022 at 10:35:59AM -0800, Dan Williams wrote: > > On Thu, Jan 27, 2022 at 9:55 AM wrote: > > > > > [snip] > > I'll address the other comments later but wanted to address the idea below. > > > > diff --git a/include/linux/sched.h b/include/linux/sched.h > > > index f5b2be39a78c..5020ed7e67b7 100644 > > > --- a/include/linux/sched.h > > > +++ b/include/linux/sched.h > > > @@ -1492,6 +1492,13 @@ struct task_struct { > > > struct callback_head l1d_flush_kill; > > > #endif > > > > > > +#ifdef CONFIG_DEVMAP_ACCESS_PROTECTION > > > + /* > > > + * NOTE: pgmap_prot_count is modified within a single thread of > > > + * execution. So it does not need to be atomic_t. > > > + */ > > > + u32 pgmap_prot_count; > > > +#endif > > > > It's not at all clear why the task struct needs to be burdened with > > this accounting. Given that a devmap instance is needed to manage page > > protections, why not move the nested protection tracking to a percpu > > variable relative to an @pgmap arg? Something like: > > > > void __pgmap_mk_readwrite(struct dev_pagemap *pgmap) > > { > > migrate_disable(); > > preempt_disable(); > > Why burden threads like this? kmap_local_page() is perfectly able to migrate > or be preempted? > > I think this is way to restrictive. kmap_local_page() holds migrate_disable() over the entire mapping, so we're only talking about preempt_disable(). I tend to think that bloating task_struct for something that is rarely used "kmap on dax pmem pages" is not the right tradeoff.