Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1700515pxb; Fri, 26 Feb 2021 19:39:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBLMKx341ly4GLe/ACX053Jv54WkX/wLCtSm+8rcIpNGaL/lJbXDrhuH4nSPsM/UbuIUUF X-Received: by 2002:a17:906:3285:: with SMTP id 5mr6580178ejw.356.1614397160671; Fri, 26 Feb 2021 19:39:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614397160; cv=none; d=google.com; s=arc-20160816; b=pOtnPEjVFvULnJIvLT76e3mNGadTWWGLSp10Q3/s1EQC2N4pkApcR/u2Qav0MoqDw2 6vrII7tzsHz+SjhHtiU8pllOkMOJ+3ya1W2bvFiyNrXEaLQ4TKEEOMhl6pL67534t1Ow 3JdztHmGQExb8+nfKlvbRxfLesKXeKYJwxGXQ+L5CeZt3D7QfQmRSodR5Lt5i75FXTXo XHP/nV2X+UMfSCiLYyK/13yJcTZbtvOihJCeP1L+k2elIyizgJ7ajrs9GaBv2T0++oW+ l7v2cxxAgXmC+tnq38y9tG4ClvbO7y2fNekaFgjh3SZ8zTqRjMgiBbe5YBzos4XzpAYB vFWw== 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:message-id:in-reply-to :date:references:subject:cc:to:from; bh=mE7VJvzeHMpii8r88AUDO0jj5jNpHMnulkbNdW0wuhQ=; b=QAw8Alq0NhqBeAUuGZWXR+DF6bCS70IdKGKvazACCQj6P2ws4qJZolFz+Xvt/mbaed 0c7570/xA6eSjH5chQa87v5h/0e9PcAohdgKbtFi0zOq5aCcovuNllYa9HZZg33VB50+ Cifxth+cw7lMDe9AnYRXrq7xjkTNlgcbdAo7EL0sRHDDQmNFo0W6O9OlAQyMInhch3t8 dYZGxksJwf0UAaGCAb9Lp+O7+urS85QOQTtNysPlGbwpTI70b6UgaOtMaU5zUzvGQKxT SUwS8JqhULFMPMz1hy0VXX6fXHZb5zVBOzzhtTylZR5mpoDyeJIJKvrZJQqY8SoHYjM0 hwdA== ARC-Authentication-Results: i=1; mx.google.com; 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 v7si7373147edj.572.2021.02.26.19.38.58; Fri, 26 Feb 2021 19:39:20 -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; 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 S230190AbhB0Dgw (ORCPT + 99 others); Fri, 26 Feb 2021 22:36:52 -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