Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1794854pxj; Fri, 18 Jun 2021 16:03:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhCQWqVfQl4UlJ9g7zLSJVnr50/RxbQWL4P250PemWJmF9DDHv9aJSvXzs7DKqZkuL4Euh X-Received: by 2002:a05:6402:4316:: with SMTP id m22mr7899918edc.316.1624057423506; Fri, 18 Jun 2021 16:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624057423; cv=none; d=google.com; s=arc-20160816; b=Z4th8fIPOc4nurB9/v0uCULiN3GFKJSe4hlREOiUnC2JHF9XKZB+chhlGtYmP/DYq8 Pjc9agP24eP3+FIRvaYjoRsXyoRU+mS/QTA2/UDc1jNHDz/U+Us1VaKudnOSkFknlFEQ p+O494qngJv9hIZ3kaMYVkwPZVuPbKjIk77xxdgF+DdWSI5LMHyDsY7ZsrGWyRkQhg9l 3kOxmy2FvvZIQXg9r5YrQ5esa8/NZwm2kxofJMhdn/GbmwETjiyj9fiMEeSYV/gpqykt 6dBE+srWZmRMzQiW5arZXyBCjF6z1DAb6R8iE563jCKG+to3nE8cQcrLtRZux7cFdFyY vPUQ== 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=q7m1o44oSVq8zyIvkZdUoj8bVMxRp47wBwVWvLCOhik=; b=dTt6ldkS5vWiH38TTjw/zJemrqNg8X8zvKXwxNVfOwHGYMrRewAVytywW13XBVYMbj Gv6pXhGMEO/ZWs09kfGuZ3uddBYs7I+Ew9I7IoycdGUZvoC5FgfEb7Xz211wwJKIEEq0 xM7k1dEIGl34KWgvKNxB1Ap+uGwW5p4TdUiVJ+ZMD/9JLW81RDeE7veRKzmT+TcChKZq clBTHWjz+v7oL3i5rO3U6Vp/W33hUYw2BipBZv805L3296QwMhkB0DCnLmhnL0gQOVFC i4cG6EHaH2t6a4MTGjE6Yk0I59PmJJR1gmq1anoTv8wU6gCLY/xqRjhFWvTs46HkfysV AqBQ== 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 n17si10087539edy.506.2021.06.18.16.03.21; Fri, 18 Jun 2021 16:03:43 -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 S235012AbhFRSPK (ORCPT + 99 others); Fri, 18 Jun 2021 14:15:10 -0400 Received: from mga01.intel.com ([192.55.52.88]:21508 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbhFRSPK (ORCPT ); Fri, 18 Jun 2021 14:15:10 -0400 IronPort-SDR: 4BfT8humAN2ALNjUzCLOCS4uv0cmFaxGAqim28EeRyYYtSF34bEVludBax4VEqIhmX6Z+Y46v5 p/PHYgt9Julw== X-IronPort-AV: E=McAfee;i="6200,9189,10019"; a="228130352" X-IronPort-AV: E=Sophos;i="5.83,284,1616482800"; d="scan'208";a="228130352" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2021 11:13:00 -0700 IronPort-SDR: fZjz2UBcjkF09ZLFZzZqWyvwCbkGqlZanM6atUtLAcrBp3dXyferraXT69g8eiZc0puz+dQdsp 3jQAgCFqGSuA== X-IronPort-AV: E=Sophos;i="5.83,284,1616482800"; d="scan'208";a="453226714" 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; 18 Jun 2021 11:12:58 -0700 Date: Fri, 18 Jun 2021 11:12:58 -0700 From: Ira Weiny To: Herbert Xu Cc: Christoph Hellwig , Jens Axboe , Thomas Gleixner , Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , "James E.J. Bottomley" , dm-devel@redhat.com, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, ceph-devel@vger.kernel.org, linux-arch@vger.kernel.org, "David S. Miller" , Christoph Lameter Subject: Re: [PATCH 01/18] mm: add a kunmap_local_dirty helper Message-ID: <20210618181258.GC1905674@iweiny-DESK2.sc.intel.com> References: <20210615132456.753241-1-hch@lst.de> <20210615132456.753241-2-hch@lst.de> <20210618030157.GA1905674@iweiny-DESK2.sc.intel.com> <20210618033728.GA16787@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210618033728.GA16787@gondor.apana.org.au> User-Agent: Mutt/1.11.1 (2018-12-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 18, 2021 at 11:37:28AM +0800, Herbert Xu wrote: > On Thu, Jun 17, 2021 at 08:01:57PM -0700, Ira Weiny wrote: > > > > > + flush_kernel_dcache_page(__page); \ > > > > Is this required on 32bit systems? Why is kunmap_flush_on_unmap() not > > sufficient on 64bit systems? The normal kunmap_local() path does that. > > > > I'm sorry but I did not see a conclusion to my query on V1. Herbert implied the > > he just copied from the crypto code.[1] I'm concerned that this _dirty() call > > is just going to confuse the users of kmap even more. So why can't we get to > > the bottom of why flush_kernel_dcache_page() needs so much logic around it > > before complicating the general kernel users. > > > > I would like to see it go away if possible. > > This thread may be related: > > https://lwn.net/Articles/240249/ Interesting! Thanks! Digging around a bit more I found: https://lore.kernel.org/patchwork/patch/439637/ Auditing all the flush_dcache_page() arch code reveals that the mapping field is either unused, or is checked for NULL. Furthermore, all the implementations call page_mapping_file() which further limits the page to not be a swap page. All flush_kernel_dcache_page() implementations appears to operate the same way in all arch's which define that call. So I'm confident now that additional !PageSlab(__page) checks are not needed and this patch is unnecessary. Christoph, can we leave this out of the kmap API and just fold the flush_kernel_dcache_page() calls back into the bvec code? Unfortunately, I'm not convinced this can be handled completely by kunmap_local() nor the mem*_page() calls because there is a difference between flush_dcache_page() and flush_kernel_dcache_page() in most archs... [parisc being an exception which falls back to flush_kernel_dcache_page()]... It seems like the generic unmap path _should_ be able to determine which call to make based on the page but I'd have to look at that more. Ira