From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B048C43603 for ; Thu, 12 Dec 2019 01:56:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E4676214D8 for ; Thu, 12 Dec 2019 01:56:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FC0stfuj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4676214D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7ED026B350F; Wed, 11 Dec 2019 20:56:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 79D5E6B3510; Wed, 11 Dec 2019 20:56:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B39A6B3511; Wed, 11 Dec 2019 20:56:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 519036B350F for ; Wed, 11 Dec 2019 20:56:17 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id F0098181AEF15 for ; Thu, 12 Dec 2019 01:56:16 +0000 (UTC) X-FDA: 76254824352.27.wood11_710074eb3e71d X-HE-Tag: wood11_710074eb3e71d X-Filterd-Recvd-Size: 3826 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Dec 2019 01:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=I5UsU67I10U8p0BYxrNMZR+/KpiEMW7RPdqeQzSS9a4=; b=FC0stfujHU0QXKM++ACD9PdZp ClLIfR8IEBlhLBIgAYdPg0fwZVxLfklermQri0rET3qpnMVcdBol4v5GGmwEiSnQvMJ4Tqdaof8du 34i3vUSJdgIuHgjddtPpazocRhy/y5vpvQVuAoMrTlyICZkTdaGtBIFdo5/m9d7oL5NB2aM4vraZw Fvon0HMmzEt5NqKthMew0jnjX2E5wDwgsI4BIbZqE9hXKf60SU6wiQ4Fw/icU+iVq9vgvEzBowacT MTCuL0tptuK1k9L7vW0CjYhLJXieQ1+5O84+gnu4T6EC/VKELcAYvJ68iMQgf0EbcVPjofnbX4WEb X9IKD5vzw==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1ifDi8-0000hU-Ja; Thu, 12 Dec 2019 01:56:12 +0000 Date: Wed, 11 Dec 2019 17:56:12 -0800 From: Matthew Wilcox To: Linus Torvalds Cc: Jens Axboe , Linux-MM , linux-fsdevel , linux-block , Chris Mason , Dave Chinner , Johannes Weiner Subject: Re: [PATCHSET v3 0/5] Support for RWF_UNCACHED Message-ID: <20191212015612.GP32169@bombadil.infradead.org> References: <0d4e3954-c467-30a7-5a8e-7c4180275533@kernel.dk> <1c93194a-ed91-c3aa-deb5-a3394805defb@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Dec 11, 2019 at 05:41:16PM -0800, Linus Torvalds wrote: > I too can see xas_create using 30% CPU time, but that's when I do a > perf record on just kswapd - and when I actually look at it on a > system level, it looks nowhere near that bad. > > So I think people should look at this. Part of it might be for Willy: > does that xas_create() need to be that expensive? I hate how "perf" > callchains work, but it does look like it is probably > page_cache_delete -> xas_store -> xas_create that is the bulk of the > cost there. > > Replacing the real page with the shadow entry shouldn't be that big of > a deal, I would really hope. > > Willy, that used to be a __radix_tree_lookup -> __radix_tree_replace > thing, is there perhaps some simple optmization that could be done on > the XArray case here? It _should_ be the same order of complexity. Since there's already a page in the page cache, xas_create() just walks its way down to the right node calling xas_descend() and then xas_store() does the equivalent of __radix_tree_replace(). I don't see a bug that would make it more expensive than the old code ... a 10GB file is going to have four levels of radix tree node, so it shouldn't even spend that long looking for the right node.