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 9B9B9C433E0 for ; Sat, 27 Feb 2021 03:37:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 684CE64E7A for ; Sat, 27 Feb 2021 03:37:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230209AbhB0Dgy (ORCPT ); Fri, 26 Feb 2021 22:36:54 -0500 Received: from mail.parknet.co.jp ([210.171.160.6]:43690 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhB0Dgr (ORCPT ); Fri, 26 Feb 2021 22:36:47 -0500 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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