Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1429769lqd; Thu, 25 Apr 2024 15:49:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW0OuE5EbKY6/B0VFTLipKcmv04vZ98PCgSfX4xTaOIDvvsL15MtKCy3wpoRr4fuQObbei88jghsbdwv/ATgdPP8JjcjG2iUzaPIsriEw== X-Google-Smtp-Source: AGHT+IFo7nsVE9A9y2S1DaXuSDORKNDhV63Y/lIvYFEsNv00hNHXbk3Kxht8IvlWHCG5g+Ww8ZBy X-Received: by 2002:a9d:7305:0:b0:6ea:2a7c:2900 with SMTP id e5-20020a9d7305000000b006ea2a7c2900mr739040otk.25.1714085361416; Thu, 25 Apr 2024 15:49:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714085361; cv=pass; d=google.com; s=arc-20160816; b=Efst6UYfWdbwh69lx34gnYx8LhFwb+XIZMFxRHFahvRpvVe7aJn6GUo+oNcdvzsqw2 2V9CmiOITKO0oB2pdm9mlgZ7HHs7p7bdZVaVNIud1ObAH/3FGysfVNv8F6j0sz2A+1YV ZXV3o6MonmECjOwcT0s8xwlEXGntzVoI/OV9/lRw0v4pw4wvCIGP2syhzy6xe1phhSuk gVVpKJ5vDlCol2QBPYnEhuiX5yYY8PBlHYXbqvE8F403dl91WC5kqEFmfH/K0kbsbKGm FZKR1U4p+tFZPo7nr6nopVlSAUwrUjCw2TTOB/L3ETinojeuArNEn+8xcXcOB9zQt7y4 dtuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aPI+REeR7ehD8uzT6D6XxnDHOJihS/G4o6C/kIyX9uM=; fh=px0tNHw6eUEfzMI5bLu9D7tHfIxcun0IB5yAxkWPzCc=; b=ZqrYO1vbco6Bs+/NJgtW9A01djA9f1XnEHQ6UBRJB9dbPjqw/LyoPJMKfo/wQKtM0D +vJuBRDONGGGpNWa5dlJyuLXcd9MsN+11gnuNrZhdewZSJgPtAEPtOQAgy4VRkgPPNOh BsOG3Hjss3WcPVUh0wpyjpI0svLWLYnOMqFd20BP+ooLCHNy2MrkFP6xzWQFeDKrer8B J+9favzijuQWdRUhuI50pfXiOyMXyDrUtz9fn+ZS1fLsbZUmLaoskHdEhOWSRj7eUAML aB2P05HbsdUdz4Q0t+PGkSOm7Po1OziCmtoPE19P/eH6i56QA2rR5qckbbumdQ2RtjGn IFgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=lPp7XSJg; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-159121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159121-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x3-20020a634a03000000b00604b86e9ec3si4399833pga.838.2024.04.25.15.49.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 15:49:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=lPp7XSJg; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-159121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159121-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8C5ACB24BAD for ; Thu, 25 Apr 2024 20:25:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 628B0153BF2; Thu, 25 Apr 2024 20:24:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="lPp7XSJg" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 326D015351C; Thu, 25 Apr 2024 20:24:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714076681; cv=none; b=MMTYBaxtS39hzrxzvmMAD2Ge8Pt6eJq34iEr5wKtF4eNx0wyOsFAGwMqCZti2iFbHeNuT/95aGrDVYPzS6PqAlN/1cwiMClVOmOO1qKMeIL5EtgIDtso0eEvyiE6qykONE6V9iD9qNDqsQj8HkfosQS4gJ41CYzP6u25BlKcoxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714076681; c=relaxed/simple; bh=t6MvdvHbsofObq/f2/jeAEInKWwAadopbL4fZZZ0i0k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=E913dmKVFu5FfkWw5w8OHzCcP0runs6f7+SsJ3V4aBoqgz/KePBm7yQF3ZvSXURNioELAL8rXFmg3Daviy8ykDM2MRtrYxs0XqV3+dN4iRwBXauG7W7RkLaVLEcapOWVgg9PKGQVKv7rUVxyFBv5f26LWPTOg3ofkcgDuWd4/YQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=lPp7XSJg; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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=aPI+REeR7ehD8uzT6D6XxnDHOJihS/G4o6C/kIyX9uM=; b=lPp7XSJgb/pOL8V98kRsv6/EMT VnAqT4WFX66hgjwwHp579W67Kn5pgqbXose2hro4ga/tmMpIvCjzPxkkszCs62Rjn5NJZ4q2NtHGg 0fwyAVq3Fx/4Z77NG5R5bl9iphq8ysrV98J5TRiOYw0V0mmdDqwN/FW2vmuagAn45zyNLEgyPxVWo Na6lmOD/qa0TAIMy/XB4XbH1kM8arNUL2Jj8e5p2Oc4rX8Z3W3uLhQtF+UVnvXMIsdvKCQueKTBbS unv3oEdxTgSlktnSzxyRxn58CG9uqb30ArVUZqXybllM6te6cMMlaOvwB8XZj9580fYaE432aQW5v gdRmykOA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1s05dx-00000003jQX-2rsR; Thu, 25 Apr 2024 20:24:33 +0000 Date: Thu, 25 Apr 2024 21:24:33 +0100 From: Matthew Wilcox To: "Pankaj Raghav (Samsung)" Cc: djwong@kernel.org, brauner@kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, hare@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, mcgrof@kernel.org, gost.dev@samsung.com, p.raghav@samsung.com Subject: Re: [PATCH v4 06/11] filemap: cap PTE range to be created to i_size in folio_map_range() Message-ID: References: <20240425113746.335530-1-kernel@pankajraghav.com> <20240425113746.335530-7-kernel@pankajraghav.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240425113746.335530-7-kernel@pankajraghav.com> On Thu, Apr 25, 2024 at 01:37:41PM +0200, Pankaj Raghav (Samsung) wrote: > do { > unsigned long end; > + unsigned long i_size; Usually i_size is the name of a variable that contains an loff_t, not a page count. Not sure what to call this though. Also, can't we move this outside the loop? pgoff_t file_end = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE) - 1; if (end_pgoff > file_end) end_pgoff = file_end;