Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp191090pxf; Wed, 17 Mar 2021 19:46:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwq5r23SugBKXeWohJPIMBYuzMrH9RhPztustFgbwSPRphrUuIrYl7+KZZ/XdUfv4G3Gwfu X-Received: by 2002:a17:906:7fc4:: with SMTP id r4mr38116783ejs.81.1616035594839; Wed, 17 Mar 2021 19:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616035594; cv=none; d=google.com; s=arc-20160816; b=PbLAbJwguZ/1NttR7Ts7ZW+Q718v+Ymr+bbyqojUe4EHXXADpCv+ZWeMvy1YavMqmI o5ew/oa5Hd/2UZgMWWJ1MpFoHI22HwXcTgSy2jbTPVhhRc7urZv/RDBHxD56X8PoEJuJ kkshhfkVxZw0WNJ3UPDYo03/3vMEJ57nb19TQBUBmZRwOCkrM6bk6iRTwCglStW54gVj W7ihBpcAgquIqToabS/Ii5gYZ+gMhPZ8se/lNl5+WGvmjQ3/ell3P4UD1HDVWJ1x881b 7zgKMHJpFU48Ush7LkkCNKhv+A/ur7CTxIhUFj9GLGJN0A/JBYbg4T2lvPSrEVV+FnJ3 GOQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=3M3ZdflZepd1gdnXxFJgdYB3je5opxireG8KxkIfyqI=; b=nRgBAmYL7meKW4Jl4D0m2p0oydy/Vvl7JF2POWymwf3Muerji/ZxEqi0injI5Qd6d9 VwHNlIuhmCMdEUEeTWC5d/ibjgQPa/pkbanOpfsj7ti97nH4kr8oNUu/oj0YVNVCONgM aKKLhATYuA+Jlk4ibJvDo6xbP63H1/K0zphz2ncdKa6UEfhXTMRKgqatEcy50fqxD5Rs yPZQEIlligMnvqMjlx42aQNcAMjaUCGIJH17XwE2CuNZcgI1YeVtizhqoxphH9f0t7dX AR9oJQeMjb/m7Sq14951GCMDvTbgxtmMHo6P0nHIG2jckFWPbvNYvPMtI62j3dGVswAW SYGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs9si481743edb.575.2021.03.17.19.46.12; Wed, 17 Mar 2021 19:46:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230516AbhCRCon (ORCPT + 99 others); Wed, 17 Mar 2021 22:44:43 -0400 Received: from mga11.intel.com ([192.55.52.93]:63958 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230525AbhCRCoU (ORCPT ); Wed, 17 Mar 2021 22:44:20 -0400 IronPort-SDR: pCCmbqAB35mHGfS0lLS+kvcwFe8rDg2Yf59HvfqkDRQd+HtE/39BAkei4x1TjHG5sj2POdJrdD 3pSCRooejvlw== X-IronPort-AV: E=McAfee;i="6000,8403,9926"; a="186232236" X-IronPort-AV: E=Sophos;i="5.81,257,1610438400"; d="scan'208";a="186232236" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 19:44:20 -0700 IronPort-SDR: FbkhzGsVEg6f0l7pM2QQBIjpDFVw/Cyn3rjWSHO1xLXN8PdCpvEhUntE8+92VloM0PObRHOikv 6ZckVjbfs0wQ== X-IronPort-AV: E=Sophos;i="5.81,257,1610438400"; d="scan'208";a="406170075" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 19:44:20 -0700 Date: Wed, 17 Mar 2021 19:44:20 -0700 From: Ira Weiny To: Thomas Gleixner Cc: Christoph Hellwig , linux-kernel@vger.kernel.org Subject: Re: kmap_local semantics Message-ID: <20210318024418.GX3014244@iweiny-DESK2.sc.intel.com> References: <20210312065413.GA29805@lst.de> <20210312153646.GE3014244@iweiny-DESK2.sc.intel.com> <878s6lzxsq.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <878s6lzxsq.fsf@nanos.tec.linutronix.de> User-Agent: Mutt/1.11.1 (2018-12-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 17, 2021 at 02:59:01PM +0100, Thomas Gleixner wrote: > On Fri, Mar 12 2021 at 07:36, Ira Weiny wrote: > > On Fri, Mar 12, 2021 at 07:54:13AM +0100, Christoph Hellwig wrote: > >> So with the new kmap_local interface is it possible / advisable to > >> use local kmaps over code that might schedule(), e.g. to wait for I/O? > > > > It is possible yes. "Advisable" I think so. Thomas knows better than I what > > performance would be. > > The performance impact is only relevant for 32bit machines with HIGHMEM > enabled. On 64bit kmap_local is a NOOP except when you enable > CONFIG_DEBUG_KMAP_LOCAL there which then actually does the mapping (on > x86 only for now) with guard maps between and that will do the 'drop > map' on schedule out and restore on schedule in dance. But for regular > 64bit there is absolutely _NO_ overhead. Thanks for clarification. > > > FWIW I have been working on converting kmaps to kmap_local. Most of the > > instances don't schedule AFAICT. > > The whole point of kmap_local is to be preemptible and does not have the > nasty side effects of kmap_atomic, except for the 1 page per map and map > nesting ordering requirements. > > > What I really don't want to see is any kmap'ings handed to another thread. I > > am working hard to eliminate the use of kmap for that use. Is that going to be > > a problem? > > kmap != kmap_local > > kmap_local mappings are thread local and can't be handed anywhere. It's > documented. Agreed. I'm Sorry, I did not word the above clearly enough. Let me rephrase that. Christoph, do you anticipate additional need to call kmap and hand the mappings to other threads? If not then kmap_local is what you should use. If so, I'd like to know why. Ira > > Thanks, > > tglx