Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp248892lqf; Fri, 26 Apr 2024 05:54:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBuMCWe2mfZDe/vyygyXss50QhYB6XOA4sbZ+/n2zI7A4qS7j+PZVa88o0iNYJDlvXeRrtiZGPukf+txrOVg4mgMajLAgOZ3IS761UTw== X-Google-Smtp-Source: AGHT+IGbeYSAECUsrHGSmZSLvpXg7YWDlUVpVETPznRvZ0bXcBe/XkoekwsgGZwAgCOT8XhcAknp X-Received: by 2002:a05:6870:a79f:b0:22f:bdb:6335 with SMTP id x31-20020a056870a79f00b0022f0bdb6335mr3144899oao.7.1714136076443; Fri, 26 Apr 2024 05:54:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714136076; cv=pass; d=google.com; s=arc-20160816; b=AhR4d86KYeJAwPqykLGFQXSrECPxeSDYA+Q88UPD4wzJtaEU1RPf/kMUaggYa0HeJR KZ3+LWsmz3/ittk4Lu49NFPn0d/khnEdQwjOM7DPi0HdPStWjMCzdNv/68gyOfOBhtbB l3JbJytM/mfSRzyhgKV6Vnb8Ub55xh9eBcvUReJnvhOM/z9H/wIU2fQb3VlqzG/prFdU n8NG3h3lZGDqwjPmIsDKulI8DKptmtGcm90k/p14qcQtHzcDcZ/4YCJNmx+urI/T3Cpd RYdPxECd50sPXiiZ5WaolVkYGXOan0R0eRGw5xyX2T46dNcqk+yNcW+HR7mIwcGqF2OO /bfw== 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=gvK113BQiEHRRB+jUoKp4pYoXm1qV6dv7bI+yo26L2s=; fh=RZJH5Q8Bk2lE2jGw5kmw1vAQr6lyDE3jnRYWsge2y+s=; b=mLA0lfVK74W0ve7XtcmPwwCSJTVfRrBnJUFGK585uta+sMreZlFl5PYrbWpYtC/U6M v21DQMxm69Jk4Xw+AAoCg2QcEKtW8/dx09Vv7Ta4uOykgA4Zn/D/KhHd9e2JEp/+iqjD UUoXopmYF9mfMcc7la517BlZPI76YZULoCNQF5A3WH+pEJe069lERpfGAGeSk5Qe6+uK YSw+VsS815X4L7lCKJACYZn6FeWodbLYgJ20d+1kNvzLwiCe+uty623LTH4P9rYeTC5Z Yr8gH4DIukrh8bCl0cSRUf+15K4ZnF98snbq2tuaBTdvBu1rOROxVGKNSxzP0O8mg0Fl 6CDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=BTuW3g2S; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-160002-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160002-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x21-20020a63b215000000b005fd85b3b336si10037081pge.744.2024.04.26.05.54.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 05:54:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160002-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=BTuW3g2S; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-160002-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160002-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 44A6528378B for ; Fri, 26 Apr 2024 12:54:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3CB5146D52; Fri, 26 Apr 2024 12:54:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="BTuW3g2S" Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (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 B732213E88A; Fri, 26 Apr 2024 12:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714136066; cv=none; b=KxGHt6qzLeYXT9ZqpCpMNX2lWexmcci75/A1wG0mQiLCXqX+jLYwR/25MYPitT3Z8xwfL6mpazCndjNcx/vk+UO5rO/XB+cGfGEG10Y60x5HTolgZ28Qq6N/B1bgSYUIRePY9fUHCboLAua24zDLv8u/lnRTJpaXA8l36Pad7vg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714136066; c=relaxed/simple; bh=PxjWk/DnfndZp7Tnn7yylcFvdTm55zeOL5HaDoGiQmk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=obj1MlVzxMKCzOWkkuoldF+OyflLenn5/gMRgu6r4j4mxxhG8mJMUfeI4E56btQEoym8Ny3fC0ny5OoM8Yu83Mj3e1xchap3AGurIRxBxE3qUw5Ini+2QOfLi/O4Y/PVuuVbPiPAhe2wi9OvSSoO/iAeE5E4RIRyAP1LDqK5Zt0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com; spf=pass smtp.mailfrom=pankajraghav.com; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b=BTuW3g2S; arc=none smtp.client-ip=80.241.56.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pankajraghav.com Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4VQt2t2hJHz9sWd; Fri, 26 Apr 2024 14:54:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1714136054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gvK113BQiEHRRB+jUoKp4pYoXm1qV6dv7bI+yo26L2s=; b=BTuW3g2SAvenk5ulUQkTFm/sWdNlXv7N24BPmPPBaebmxLqAgsb6/bjYKvZFi1tXEyURDs FFtbT8+qEIgbOeyGBt6/Ck0n5PbnTRU/Kd7YkQauiA/i1GguM1ng3uvFUQQkPwATqo2ltU 6Z4HHR9ONyV6D+sa7/PCLEKNuQqk6pNlhb5WAvyO4P/T9su5NU/w8YKk8Zv1ZpkK4xNbX+ FbiE6k/QnNgoeVNPla27GvFtpgRdYs8WJRCkI0Wr8sdUqH4vs7BzuLD8ERFRkmPHmdS3mC 69dnlhPWlRY9OFVf+HF+kIqZ0A8drq895qT8D/8OIEonLq3EAkTWcA2vYKuiBA== Date: Fri, 26 Apr 2024 12:54:10 +0000 From: "Pankaj Raghav (Samsung)" To: Matthew Wilcox 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: <20240426125410.myhl33aewkd6wpzf@quentin> 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: On Thu, Apr 25, 2024 at 09:24:33PM +0100, Matthew Wilcox wrote: > 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? You are right, this can move out as i_size is not going to change. I will make this change. Thanks! > > pgoff_t file_end = DIV_ROUND_UP(i_size_read(mapping->host), > PAGE_SIZE) - 1; > > if (end_pgoff > file_end) > end_pgoff = file_end; -- Pankaj