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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 076A6C369C6 for ; Wed, 25 Sep 2024 10:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 993BA6B0089; Wed, 25 Sep 2024 06:05:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 943B96B008C; Wed, 25 Sep 2024 06:05:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 832A06B0092; Wed, 25 Sep 2024 06:05:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 645E16B0089 for ; Wed, 25 Sep 2024 06:05:39 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EDCFCC0B04 for ; Wed, 25 Sep 2024 10:05:38 +0000 (UTC) X-FDA: 82602828756.20.6EFA7CE Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf08.hostedemail.com (Postfix) with ESMTP id B42C6160021 for ; Wed, 25 Sep 2024 10:05:36 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf08.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727258617; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e5ySudKEzO3otYcm2RSI2zoDblMQoInA4cXkcyXtubc=; b=zQUhf8sVSW6uRC2aDsgQqHp+1tSck1/t3LJoARYjQj89jg+NVe363aMrX34Av0wps+wut6 qrql1NSLfjRIictrqtv4pTiaDTeJaAGIJnMvizli5Wx4PRKQGCDPrQwMDAMPcXil3GqfSN 0N0dyfdtsJ1ZOSMEU1Ih6IjFn+AP2go= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727258617; a=rsa-sha256; cv=none; b=09DTrlVDdIH4ve0CsE+wJhCTqF/t4xgehDlf8L/mqWNuGOr5w26pyrp7hcB1yHQbiY+V/k uXwfe4Hp9zhKcZqNSRJ9QfzTDp0HRQqoHWWaSqm5gTv2HlQ+p69q75a8cKqqo0oAO+KiMx xkfATRCf59kN3+ucZgQnKVPJmDjcKIk= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf08.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4XDC664Lgnz9sSK; Wed, 25 Sep 2024 12:05:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tdRuDw19ZA5l; Wed, 25 Sep 2024 12:05:34 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4XDC663XQwz9sRr; Wed, 25 Sep 2024 12:05:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 66F1B8B76E; Wed, 25 Sep 2024 12:05:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id PJHxtpbIOOEt; Wed, 25 Sep 2024 12:05:34 +0200 (CEST) Received: from [192.168.232.90] (PO27091.IDSI0.si.c-s.fr [192.168.232.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CBE218B763; Wed, 25 Sep 2024 12:05:33 +0200 (CEST) Message-ID: Date: Wed, 25 Sep 2024 12:05:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2 0/7] mm: Use pxdp_get() for accessing page table entries To: Anshuman Khandual , linux-mm@kvack.org Cc: Andrew Morton , David Hildenbrand , Ryan Roberts , "Mike Rapoport (IBM)" , Arnd Bergmann , x86@kernel.org, linux-m68k@lists.linux-m68k.org, linux-fsdevel@vger.kernel.org, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org References: <20240917073117.1531207-1-anshuman.khandual@arm.com> Content-Language: fr-FR From: Christophe Leroy In-Reply-To: <20240917073117.1531207-1-anshuman.khandual@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B42C6160021 X-Stat-Signature: wuxsmqx9j3xbemnk9zykz41r63h8cfrk X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1727258736-852956 X-HE-Meta: U2FsdGVkX1+qDjFzuPy9+1NZhvk2ZHpqlTp3CMlndDk/8rLc+PegIGeu5vMkE0QFuK2zIKeX7hyRBrX34l4gaNE98TIzW8WET52AG6JKRSGwdbpvuIYBaKjz0KVYWsmBsJo5tbGPDjiW2AWWQK0fa5+m2Txgq0p5Bt5vy4vOtBzXCF9Uwcxorok/krXp5tJvQILyPumArvlswt8V8n9hDAhEPylIaqMSVgvKBP+ge2gpHqQYpvg9bC6ktQSiNnme9rwpTpo4TJdoc78/HarNt23Vlds+4Li/8yH4q6LqSMAW4XP9PR9w20Goc3mrBNKO+Ja1MAMGszy7ZvIltWwU1V24y26K8nxH68b4VZXA9i5znzDDKZPxQtLGyha95x5advm1yu7vuHcCRss6+FuwcnJVWYv9JNSkG1hACEWDxS9wO1wp2QvQBRmRThKY5A6/Wjes+tL8NbKjT9txEF5NjU83X1/3PbOlKKoil9fl9q7VBWuujtOE4I2i3TopPd3rMxfK/CbhZmk48Dhxx8sfWQmFo9fJE+h4A7LkETSZdk/ep3ndfLc2mSX//4NoZnRyCHjnYVHjlz16D1UqhB1DEZEyQ2W8cLk88ZpM0mT0IiExTxoewuPE6tZL8/3rtbZGQ6Fj39r5yhScYCrCImChoFevMOuIAzbeUmD6KiobXuxxz0z05Nk9v7xufEAM/sS/PDQKcZFfmQ3TIa7f8YrUue9JlbJyJ4abwki0bCnoRkJJVqyNCvcdLWbl28Wt0PQ6Z62o7V/rqgHOea+mlVgXJyrLKPv1QYNjPKMxVFd3zZWdSwCa/5IkR04oCHMvMGg29ko1XoI4VqOky/ogekYwGkX/RRE9MQl1FAj2U7f0YiP6wikeEZOs25DOWBP5txQ2mUMI/KY0SJgLHkzAseNk3QJcCpzK8h4oRVRoWMwf95hH20VZxVtU3WWfe7ktrK5eLdhJj//GaOEMj7G/Xea sAR5KRAh a1eFw9D8sTZdPIaxIKQBw77jCkGp9sSw7ZXnpltA3EZlqKD1Da2hsxPxSb+0VRw52O8/BJ2AhtyCiQpITm1GTgsM/v7SP+jKo32olRw0UllStjBFLWeVSDsPZOEQd44twOvUh8GCmV0tFcPLQ14a9vmY8TvplVBee1UUzewNjd+eK9/j1QGQVt9F1RtpwAEtCnIMb X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Le 17/09/2024 à 09:31, Anshuman Khandual a écrit : > This series converts all generic page table entries direct derefences via > pxdp_get() based helpers extending the changes brought in via the commit > c33c794828f2 ("mm: ptep_get() conversion"). First it does some platform > specific changes for m68k and x86 architecture. > > This series has been build tested on multiple architecture such as x86, > arm64, powerpc, powerpc64le, riscv, and m68k etc. Seems like this series imply sub-optimal code with unnecessary reads. Lets take a simple exemple : function mm_find_pmd() in mm/rmap.c On a PPC32 platform (2 level pagetables): Before the patch: 00001b54 : 1b54: 80 63 00 18 lwz r3,24(r3) 1b58: 54 84 65 3a rlwinm r4,r4,12,20,29 1b5c: 7c 63 22 14 add r3,r3,r4 1b60: 4e 80 00 20 blr Here, the function reads mm->pgd, then calculates and returns a pointer to the PMD entry corresponding to the address. After the patch: 00001b54 : 1b54: 81 23 00 18 lwz r9,24(r3) 1b58: 54 84 65 3a rlwinm r4,r4,12,20,29 1b5c: 7d 49 20 2e lwzx r10,r9,r4 <= useless read 1b60: 7c 69 22 14 add r3,r9,r4 1b64: 7d 49 20 2e lwzx r10,r9,r4 <= useless read 1b68: 7d 29 20 2e lwzx r9,r9,r4 <= useless read 1b6c: 4e 80 00 20 blr Here, the function also reads mm->pgd and still calculates and returns a pointer to the PMD entry corresponding to the address. But in addition to that it reads three times that entry while doing nothing at all with the value read. On PPC32, PMD/PUD/P4D are single entry tables folded into the corresponding PGD entry, it is therefore pointless to read the intermediate entries. Christophe