Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp726154lqj; Sun, 2 Jun 2024 20:37:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWemLSCRm5RzopN/z9Rbrr0WBg17im2jp4TZLDaziZXJffm3L72n1Or9bOd5p02lG2d0jXE1sXNZtb0uYv7hsVciPgv/DKXcxJsuio7og== X-Google-Smtp-Source: AGHT+IF2HjxvzXGumLO0RXPq9llNjuyulJVQtHYZ3sx9KxdJufG0LyQTigR+PPCNIjqYGooT7JQq X-Received: by 2002:a05:6122:1793:b0:4eb:2232:6074 with SMTP id 71dfb90a1353d-4eb2232635emr760156e0c.4.1717385826085; Sun, 02 Jun 2024 20:37:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717385826; cv=pass; d=google.com; s=arc-20160816; b=cv5jz2z72oZfUpVsvsrILa1daxmZwGrxJzi9enA9YFbcXCVzvLLDQQymWUllTHZiK2 wfs27QWmUUJbiu6fJ9hxq3D9OEv4zWDg/l8utERXZpP0PrKTx9GPmS99MknsmfIyvce+ CHruAfXsNZOtL27cgI57QMhlQH33jitTO7gJMw2IjMC7uV304YMMea1txfEAWJupJqBn 9jQa91oQN763LIjxGLYM4k18abnsJi7YkdUTfJpg3rTZGzRnhLeuXU4MITkUbILH0+RA dHiSR9xSJXiCaSqZd7Sg/Tz1G1WJdTSToW4dxIxnHdPbElmYPCtv/sv7g9tnLM/uf7hd 1umQ== 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=ECUDepRIy736K/Vh5Dkt+vDYxIgaP6kH7QsAiqgBifw=; fh=eVzMgsd4Mvjm+d1QDarjUJKLT2NFXBYhOGLy0fCT7fY=; b=EXc6AWFKYg8rf+KZ7+Ba/LZkB4J4wnJTj6yLmnkuXuaiacC5UEk2/StdHz+6SpzdHv HbjATUkKlz3XllrNvM9fk1ylTkyH4MBbANrqAhAnGC/6sK4XlS1TSoAaQidHFpngmLcp JQcQiy7xx1fIHKVKC0M5DzvYVphVcFlMJq2TVfRToabW8FcRFIqNL5M6GcKaG2lrrmld H82EVaNHS6PJwFD01PQ30zIcigyGkwfuOlP3vN3dz82TkPfJSzID8eyZG0aFT5bsRoli gIq1PizQdEslVbovJtwiOihTgpuz+3wSmxSQxF2eZoVMDM9avvNXonoXMxYRKWcqOPnE y63g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=a1zXJSxO; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-198577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198577-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794f2f05960si768347785a.33.2024.06.02.20.37.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 20:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=a1zXJSxO; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-198577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198577-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C350E1C209BD for ; Mon, 3 Jun 2024 03:37:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DEB34EAC8; Mon, 3 Jun 2024 03:36:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="a1zXJSxO" 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 DAB09631 for ; Mon, 3 Jun 2024 03:36:53 +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=1717385818; cv=none; b=pWXsMT7lrGTwcwPqybYJbuU9/U8leM71kuOnHOR1XjX+tLxRXtOiDfVLxwjAs2QOYLY8R9A07O2efrF+WJFvvwhuW78z873ESXDNv10NbhiJfsY8ozv+DIL30EFkVrq7w6OoM2PNqXkCXQavGCnICv8SZJSyRkbmX1T6zQ+5WIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717385818; c=relaxed/simple; bh=Lbtr77jWigHqruPwEIWG2BUQE9zwD+1PlKO6vXIoWlE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MKYpqLnsaObptGFae+X/gdrho0A2LjEIzrgHRIqM9FxcpQkn5srhEhAathrXm+5bbt7PuumLR46euQztzLhiBCDaIGVKXQWjrTQVjc3Uyl7DC3wjEfaabiG8CX1bJhV7AwjY73IqPS+l1BBuOu7tMskgHlcE9ZmeXSr+ghusP5k= 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=a1zXJSxO; 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=ECUDepRIy736K/Vh5Dkt+vDYxIgaP6kH7QsAiqgBifw=; b=a1zXJSxO3qG+nRJGpA7LRxR5zK qe+abRm9vlX5iWt4hlIWQLhGWtfj24qy5r71KtqOy8VEbF8TIpU5jt351JPj37z5Z8jYwvOXWJR8A olP6+mus0VFz9kRXAaqDWWBfwtFt6qK+3bepnKgWdzCvV3gLPN8DpmMg4pdTEwGgIgbELYyGPp90w KbyCWaEPUjm3X0Vj0VP4+qgyMrjYlIO1NChDmb4IujUMP98TMl3tEaDUjGG63dGto6VmDMh43zF2N DGiB0t3XS5/HGylnEFUbgN6aeIFrUteuleOexHdleKJqYfwJNIYRvWaBBG5ZJEAt59Pu0Onud/Rxz eUR7ImpQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sDyUq-0000000DoO2-0Bih; Mon, 03 Jun 2024 03:36:32 +0000 Date: Mon, 3 Jun 2024 04:36:31 +0100 From: Matthew Wilcox To: Lance Yang Cc: akpm@linux-foundation.org, ryan.roberts@arm.com, david@redhat.com, 21cnbao@gmail.com, baolin.wang@linux.alibaba.com, ziy@nvidia.com, fengwei.yin@intel.com, ying.huang@intel.com, libang.li@antgroup.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] mm/mlock: implement folio_mlock_step() using folio_pte_batch() Message-ID: References: <20240603033118.76457-1-ioworker0@gmail.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: <20240603033118.76457-1-ioworker0@gmail.com> On Mon, Jun 03, 2024 at 11:31:17AM +0800, Lance Yang wrote: > { > - unsigned int count, i, nr = folio_nr_pages(folio); > - unsigned long pfn = folio_pfn(folio); > - pte_t ptent = ptep_get(pte); Please don't move type declarations later in the function. Just because you can doesn't mean you should. > - if (!folio_test_large(folio)) > + if (likely(!folio_test_large(folio))) > return 1; How likely is this now? How likely will it be in two years time? Does this actually make any difference in either code generation or performance?