Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1157431pxu; Fri, 27 Nov 2020 00:44:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxm3LDw6z8m8yR5Ou6oiHDPUzaKMgmHOq2RbesX+PMEQBSm3kxS59azaovum4d/zI651NLa X-Received: by 2002:a17:907:265c:: with SMTP id ar28mr6476800ejc.172.1606466679095; Fri, 27 Nov 2020 00:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606466679; cv=none; d=google.com; s=arc-20160816; b=d5fAazo8X78U2aUZSaW1Meg7yTZUunqNwSYUArVi8wUa8OdB2Pux0b9BpIJ03yj3GS bXLKDT1KxLQSvK0ScaYWxHJbnt7QY76GEetnd2nzd+hOL9CkWcAu1qvFCMPU7aMW0fL5 zypS3OPZoZZUllE04XFo3Z0GN/FgbHSjjZGLjYM/HZsh1WFnfuoX5xIHL7csRUSbkGu+ 3PWevFC1Nm78sAcB4hdWcFvKyhP+grKJQ5FQN6Oufz48GYICQPtUYLeSk5ahITptfQY7 JTpucLWhZTNX0QjhYE7Ust4GqNwPVJRI6MtCGL54DsoN6gEhOvfX4hsDruqUM6vvXTIg UoxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0Oynq0P9qwAVLUJIozexhIrD4X8bgYbBxQMqU661Oro=; b=CqGzbcu/QgZeA1uhzR8B4nJINbiEV7e6bB/hHnjtuR2FsHKMrkmslR+Uq3T/WBu4gO uaQ58ehcEuqIFQCfK719A9whr10lsV167htmEo3q1tS7AFJHlvQEUST0Qrr6EhyQNhRs HL2EQKXOOyO7P1NM32Mb666r1cuJ26DUD+pa3qNDuydohu7SH36zkSH6bjBiImBBe7s6 Atws+t5+nvfpupfitkj+TwM8AeCW824Vz6+ArZ9IA9wCaZlNl+qmqFQkWBr1tBcNC6ji PugRtjC3Nm4//wxkWmT7lVcT+KzAP836L2CKH1iGPFuC4wCZKAXD7RakVCxFhsYolhD9 QeRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OaYSyI+v; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gs10si2058129ejc.618.2020.11.27.00.44.16; Fri, 27 Nov 2020 00:44:39 -0800 (PST) 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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OaYSyI+v; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390934AbgKZUHK (ORCPT + 99 others); Thu, 26 Nov 2020 15:07:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389989AbgKZUHJ (ORCPT ); Thu, 26 Nov 2020 15:07:09 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 803C0C0613D4; Thu, 26 Nov 2020 12:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=0Oynq0P9qwAVLUJIozexhIrD4X8bgYbBxQMqU661Oro=; b=OaYSyI+vbas3gKInvB8tgJHU8U l3DfxHSKXTg2R3LKiX/4ZCz6NO6M4ChYqZT0FYtOucI3gQrQwNa+4Zww5X3C68bEAsgKR5DqOGRK4 39NtnKv8nH05FPs1KJMB9wLgSPD3GTLyy89krwdar7NcUpJLoWYe+N88Mily9LvWE2bYVWpsajx5P vZsYT+um7imRp+bdpL6l93jEXbrhhmtl9Mvb45DTbxUHZc6CkB8R68o8NrXnr3rXCM34vifKg0Qan jf2Brgc1lKnwuxlJL9nkafnTa53Vs+hSRBKKAplJuDnsDqQjd9sR7m5eB1IuWdKrin3lowD9WIPmA eNgr5X3g==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiNXj-0005L2-5Z; Thu, 26 Nov 2020 20:07:03 +0000 Date: Thu, 26 Nov 2020 20:07:03 +0000 From: Matthew Wilcox To: Hugh Dickins Cc: Andrew Morton , Jan Kara , William Kucharski , Linux-FSDevel , linux-mm , Christoph Hellwig , Johannes Weiner , Yang Shi , dchinner@redhat.com, linux-kernel Subject: Re: [PATCH v4 00/16] Overhaul multi-page lookups for THP Message-ID: <20201126200703.GW4327@casper.infradead.org> References: <20201117153947.GL29991@casper.infradead.org> <20201117191513.GV29991@casper.infradead.org> <20201117234302.GC29991@casper.infradead.org> <20201125023234.GH4327@casper.infradead.org> <20201125150859.25adad8ff64db312681184bd@linux-foundation.org> <20201126121546.GN4327@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 26, 2020 at 11:24:59AM -0800, Hugh Dickins wrote: > On Thu, 26 Nov 2020, Matthew Wilcox wrote: > > On Wed, Nov 25, 2020 at 04:11:57PM -0800, Hugh Dickins wrote: > > > > + index = truncate_inode_partial_page(mapping, > > > > + page, lstart, lend); > > > > + if (index > end) > > > > + end = indices[i] - 1; > > > > } > > > > - unlock_page(page); > > > > > > The fix needed is here: instead of deleting that unlock_page(page) > > > line, it needs to be } else { unlock_page(page); } > > > > It also needs a put_page(page); > > Oh yes indeed, sorry for getting that wrong. I'd misread the > pagevec_reinit() at the end as the old pagevec_release(). Do you > really need to do pagevec_remove_exceptionals() there if you're not > using pagevec_release()? Oh, good point! > > That's now taken care of by truncate_inode_partial_page(), so if we're > > not calling that, we need to put the page as well. ie this: > > Right, but I do find it confusing that truncate_inode_partial_page() > does the unlock_page(),put_page() whereas truncate_inode_page() does > not: I think you would do better to leave them out of _partial_page(), > even if including them there saves a couple of lines somewhere else. I agree; I don't love it. The only reason I moved them in there was because after calling split_huge_page(), we have to call unlock_page(); put_page(); on the former-tail-page-that-is-now-partial, not on the head page. Hm, what I could do is return the struct page which is now the partial page. Why do I never think of these things before posting? I'll see how that works out. > But right now it's the right fix that's important: ack to yours below. > > I've not yet worked out the other issues I saw: will report when I have. > Rebooted this laptop, pretty sure it missed freeing a shmem swap entry, > not yet reproduced, will study the change there later, but the non-swap > hang in generic/476 (later seen also in generic/112) more important. The good news is that I've sorted out the SCRATCH_DEV issue with running xfstests. The bad news is that (even on an unmodified kernel), generic/027 takes 19 hours to run. On xfs, it's 4 minutes. Any idea why it's so slow on tmpfs?