Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp798606pxy; Thu, 22 Apr 2021 13:47:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMBMSl2qTCtRy3XqTFmmkZWx2QFXxPVLNJwxEt9uFz1u6vT/IcOtN5wbJu12w/NJ72A44v X-Received: by 2002:a17:902:8604:b029:e6:60ad:6921 with SMTP id f4-20020a1709028604b02900e660ad6921mr395095plo.15.1619124462838; Thu, 22 Apr 2021 13:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619124462; cv=none; d=google.com; s=arc-20160816; b=WsDRJYhls01G5AOssUHYGTNv2S7iSP2gjRJ+Cr+FYZIEnCyzlbdorkeUb9+6eGLPOx o9yeetb3RwFmNFpMpfR+7yHsDo4qC1mQRpgiGp7iS/0HOoGku5t/nthTQEM1dqnbqS0R Lz7THlM2+LNPMhJsStyBJ0CvcUIU/cl3sX0hd1klOt9mS/3TM7MFfxQ7vWmKQ7ODcRAM L9o+mgz8NGM2z86foaSrKvM6t1MZuNGfF4FxEcDISguSPgZsX2GJ2S0nz8yEPVf7us+Q EF2O7mysyXjnQi2JWcCkkrezzQ7pGZVFPsBL6r0podb1Ji7YAzJVXddnHhmpD16HQ/q2 6JIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=q4jCK/oxeOAevJ+QQnM3lBiBwG2OGtnOoyI45WiPj/0=; b=WFIRt0GULO9CZiSimbWOvkiAK8qItSJNImyQxIyk9JpCPUvt8ocTxPcM8SR1TRKJbd OWxQyft33eF0u915SLdyWST3Y2Io072BxDQvX4tB42EH7/B2S7DbEsAA0j6PNwt7fcr7 1o03Oo6Iq5n+pghGwqo09ojLG2YXre0sIk7tV0snIVd+IAQIxL70iM9MOQv2/u4JKq6a eQtQgOds4w/xcU8vJApePamqE76IG7XX95svy3ryTunIT/qWhBtWnimWMdiTs/III84s oJdOfV43dkQPaJHhylP8Hgkdwp1gpxMBxXkB/Hrwz+R7lbrPiN4k+rs0xT/2FLe2jJyU d49g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bm4tK+1+; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p11si4308867pfn.246.2021.04.22.13.47.21; Thu, 22 Apr 2021 13:47:42 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=bm4tK+1+; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239286AbhDVUrW (ORCPT + 99 others); Thu, 22 Apr 2021 16:47:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236896AbhDVUrV (ORCPT ); Thu, 22 Apr 2021 16:47:21 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57AEAC06174A for ; Thu, 22 Apr 2021 13:46:46 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id u20so15573703qku.10 for ; Thu, 22 Apr 2021 13:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=q4jCK/oxeOAevJ+QQnM3lBiBwG2OGtnOoyI45WiPj/0=; b=bm4tK+1+ztG0fhpXNYfdvm16338ubpObJL9yXAF6z5QbYek+XJkIPN5icxfAhQHZa9 5vHU3s4lI+K4LhMXS4o7k/nfFp4h1T2D/2idlxRt2E+KH+8MEGjnqj6WbRW/Occrn1ub GMWABtxA3Qa0pH+5bHwmHxHV0ytVM5PRa+hCytRC60NI1y2hUOh7ieNd8+12D82HvYI5 pTvN2mA66wfz1vd/dws+vtpU3kad6SV58lBRADz1VW6ZlvOvb8n4NfQv/NWfbrGmF8zN oD/0RCCjhIsKhandoRbU8KeYRvL+FzxbFIC6PK27w2Mg/ng/a/zrM37IDErgPKI7m1v0 /uOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=q4jCK/oxeOAevJ+QQnM3lBiBwG2OGtnOoyI45WiPj/0=; b=jCZVFa4hKOIqe5Utb8ClzOmXFddT/97kUXcAAcyLTGGo3/thofHe0ox/Hyiv5ujTS6 cBrOVvmD07wTHntaJEoulw4dtrX8SVSPXQU2z5MfBD1g3vLto+6ENXy9argxs820aVai G90XlhLFjs3exHuux7x3cgraGn86RWxnlrZ5iHq6zfTcbwawrDlMAxoiZ69orFV/C1QH jnLoC3jtDtAHHN0lXJkDMATRSoIeM1oNtz5zoqB9AHQt2G33daqTgDvpJM1LQmieTvQy xBmmXd3k79w+Axr6lcGU7sVS+OqzQENEqiiVTYk9rOlJiXbFRsSs7Tu7vhOBTrh8MR7d gu9g== X-Gm-Message-State: AOAM531CRF+ZOZLwTUG5xuOkN/4u4FNntoZDR6JXojeVHbPU5kkbR7eL L8V99tdgig88nkioiLC5VnYyJQ== X-Received: by 2002:a37:b103:: with SMTP id a3mr652299qkf.261.1619124405346; Thu, 22 Apr 2021 13:46:45 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id m124sm2975451qkc.70.2021.04.22.13.46.43 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Thu, 22 Apr 2021 13:46:45 -0700 (PDT) Date: Thu, 22 Apr 2021 13:46:34 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Matthew Wilcox cc: Andrew Morton , Hugh Dickins , William Kucharski , Christoph Hellwig , Jan Kara , Dave Chinner , Johannes Weiner , "Kirill A. Shutemov" , Yang Shi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/2] mm/filemap: fix mapping_seek_hole_data on THP & 32-bit In-Reply-To: Message-ID: References: <20210422011631.GL3596236@casper.infradead.org> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Apr 2021, Hugh Dickins wrote: > On Thu, 22 Apr 2021, Matthew Wilcox wrote: > > On Wed, Apr 21, 2021 at 05:39:14PM -0700, Hugh Dickins wrote: > > > No problem on 64-bit without huge pages, but xfstests generic/285 > > > and other SEEK_HOLE/SEEK_DATA tests have regressed on huge tmpfs, > > > and on 32-bit architectures, with the new mapping_seek_hole_data(). > > > Several different bugs turned out to need fixing. > > > > > > u64 casts added to stop unfortunate sign-extension when shifting > > > (and let's use shifts throughout, rather than mixed with * and /). > > > > That confuses me. loff_t is a signed long long, but it can't be negative > > (... right?) So how does casting it to an u64 before dividing by > > PAGE_SIZE help? > > That is a good question. Sprinkling u64s was the first thing I tried, > and I'd swear that it made a good difference at the time; but perhaps > that was all down to just the one on xas.xa_index << PAGE_SHIFT. Or > is it possible that one of the other bugs led to a negative loff_t, > and the casts got better behaviour out of that? Doubtful. > > What I certainly recall from yesterday was leaving out one (which?) > of the casts as unnecessary, and wasting quite a bit of time until I > put it back in. Did I really choose precisely the only one necessary? > > Taking most of them out did give me good quick runs just now: I'll > go over them again and try full runs on all machines. You'll think me > crazy, but yesterday's experience leaves me reluctant to change without > full testing - but agree it's not good to leave ignorant magic in. And you'll be unsurprised to hear that the test runs went fine, with all but one of those u64 casts removed. And I did locate the version of filemap.c where I'd left out one "unnecessary" cast: I had indeed chosen to remove the only one that's necessary. v2 coming up now, thanks, Hugh