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=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 313FDC433E0 for ; Sat, 27 Feb 2021 03:36:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 84CE664EE7 for ; Sat, 27 Feb 2021 03:36:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84CE664EE7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mail.parknet.co.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EA9088D0012; Fri, 26 Feb 2021 22:36:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E599F8D0001; Fri, 26 Feb 2021 22:36:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D96448D0012; Fri, 26 Feb 2021 22:36:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id C21488D0001 for ; Fri, 26 Feb 2021 22:36:09 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 923B58249980 for ; Sat, 27 Feb 2021 03:36:09 +0000 (UTC) X-FDA: 77862634458.16.00A73BE Received: from mail.parknet.co.jp (mail.parknet.co.jp [210.171.160.6]) by imf24.hostedemail.com (Postfix) with ESMTP id 18032A0009CD for ; Sat, 27 Feb 2021 03:36:01 +0000 (UTC) Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTPSA id EA1591B4053; Sat, 27 Feb 2021 12:36:05 +0900 (JST) Received: from devron.myhome.or.jp (foobar@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.15.2/8.15.2/Debian-20) with ESMTPS id 11R3a4L9550499 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 27 Feb 2021 12:36:05 +0900 Received: from devron.myhome.or.jp (foobar@localhost [127.0.0.1]) by devron.myhome.or.jp (8.15.2/8.15.2/Debian-20) with ESMTPS id 11R3a4mS2958395 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 27 Feb 2021 12:36:04 +0900 Received: (from hirofumi@localhost) by devron.myhome.or.jp (8.15.2/8.15.2/Submit) id 11R3a4MC2958394; Sat, 27 Feb 2021 12:36:04 +0900 From: OGAWA Hirofumi To: Matthew Wilcox Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Subject: Re: [PATCH] Fix zero_user_segments() with start > end References: <87eeh2erm0.fsf@mail.parknet.co.jp> <20210226205139.GI2723601@casper.infradead.org> Date: Sat, 27 Feb 2021 12:36:04 +0900 In-Reply-To: <20210226205139.GI2723601@casper.infradead.org> (Matthew Wilcox's message of "Fri, 26 Feb 2021 20:51:39 +0000") Message-ID: <87zgzq89nf.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 18032A0009CD X-Stat-Signature: a599kdzs7zce7zbx4zb6xpesez1p9cfz Received-SPF: none (parknet.co.jp>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=mail.parknet.co.jp; client-ip=210.171.160.6 X-HE-DKIM-Result: none/none X-HE-Tag: 1614396961-499385 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: Matthew Wilcox writes: > On Sat, Feb 27, 2021 at 01:11:35AM +0900, OGAWA Hirofumi wrote: >> zero_user_segments() is used from __block_write_begin_int(), for >> example like the following >> >> zero_user_segments(page, 4096, 1024, 512, 918) >> >> But new zero_user_segments() implements for HIGMEM + TRANSPARENT_HUGEPAGE >> doesn't handle "start > end" case correctly, and hits BUG_ON(). (we >> can fix __block_write_begin_int() instead though, it is the old and >> multiple usage) > > Why don't we just take out the BUG_ON instead? The function doesn't > actually do the wrong thing. end1 is underflow with if (start1 >= PAGE_SIZE) { start1 -= PAGE_SIZE; end1 -= PAGE_SIZE; } >> Also it calls kmap_atomic() unnecessary while start == end == 0. > > I'm OK with that. It always used to do that. Old one is only one page, so it is always necessary if start1/end1 or start2/end2 is valid range. But this one is multiple pages, so there are completely unnecessary pages possibly. >> Cc: >> Signed-off-by: OGAWA Hirofumi > > Fixes: 0060ef3b4e6d ("mm: support THPs in zero_user_segments") OK. -- OGAWA Hirofumi