From patchwork Tue Jun 27 03:14:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293723 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 A42D3EB64DC for ; Tue, 27 Jun 2023 03:15:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1DE38D0001; Mon, 26 Jun 2023 23:15:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ACD088E0002; Mon, 26 Jun 2023 23:15:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 920C88D0009; Mon, 26 Jun 2023 23:15:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 806208D0001 for ; Mon, 26 Jun 2023 23:15:23 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 51A2AA0816 for ; Tue, 27 Jun 2023 03:15:23 +0000 (UTC) X-FDA: 80947062126.26.EB572CB Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by imf10.hostedemail.com (Postfix) with ESMTP id 70C6BC000A for ; Tue, 27 Jun 2023 03:15:21 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GRJmT9zZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687835721; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sr5TgrSX24KD5rPSp2rkPhxpII4heal/IIgk1FACoIs=; b=UA6pRbS7ZifQIAsGcK3e6oPGHYPEuHwug12igBupKw7gU5/JhRt9awEz3X3/RTBcfKn7Yt HY8iZvwq8V6Tzbzjt4h1aTFElv2ZoIoPl5k8kPwxzoKZOd4Wg5YdvfKcROoPCeOHIJv0qz T2gfGWdLMny+7W+LEjQCuDyPPbHfKo0= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GRJmT9zZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835721; a=rsa-sha256; cv=none; b=cqrVethji5YbL6glX//Xs3DpC3JS3yaPfYMBao51p2GJ/Fmg4dk/ZdvGobNCpJn08wHiC5 wJcUDJh5U1WE3i2qBg3B3xNcEJlLEC4KIAe/eIJujm/ep+RDfDCVllqlsU2o1gEZnPo4qK VnpFqZEoWBwj1g7pO05oFVT7TbeOUoA= Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-57045429f76so40108947b3.0 for ; Mon, 26 Jun 2023 20:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835720; x=1690427720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sr5TgrSX24KD5rPSp2rkPhxpII4heal/IIgk1FACoIs=; b=GRJmT9zZCc6VZLx9VY+7Q8GbOsBn33lZq/FXBv0aXORmxRac0rj/lSqIwgsFHnmh66 6cAHAx0KI5Lagl5OZRxl+lTWKC9rW3K7h91Q6uOR2njTfEcjIvHn1/QWkX3jlNssdRYv kPZ6iyIVFwiYJpTBLvXR9/yIre3tRTqt009ghcdse7E6cPjs19QO0aXvNJJOMDpClaY7 t8HHPKKx/NAZrk3fhoJWolRioMxC3Zc40A+aLrsXlHiTMIf/9zaAkHOq7TYNlbv+VzGn jItTpyFNqlbWxSgJZgFIeDKcVXb95B0vXbDJ5HgCdgCt4hiGi9xgNTBoUpG/3ZX1ru9x fM2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835720; x=1690427720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sr5TgrSX24KD5rPSp2rkPhxpII4heal/IIgk1FACoIs=; b=SlhQOXDaFYQA/VnhnZF/JgKx+otNwrqFiTgEnDrpH4aPt34ubAA6W/s76P69+Ra+aa 5Zjl8mm6hbVuJCkT01InKqmuclWr3Df/l/8UZA255JMVr4fPQrnGuHm+CjUGiA4pkedU 3WEXbOflPfuPb1sWWR47kccG8pWMmH3qhZUldAfKasB1OpxAX0K9SL1hNL8DxhC+Bsyf 7633QHwEQFmigtVZrtQnh0L1Q+HnzqNKCJ4w2SD+xFGnI2KZ66bTqigG20tHbN3gPmTr jlzpBBYZTsOIzMnHAaAXBIpPotdzpMu5UqUZ7RGaIZIUqsjuM+z3NChMhtTPUGr6f08J BlbA== X-Gm-Message-State: AC+VfDz8UUPIaxvgf2mo12yYB6US8ZE90k3+Aw+GycpHDmfjXccORePY 5gNcpgCZPTT7nof7XttXshA= X-Google-Smtp-Source: ACHHUZ63yguTuEDNtqBAUu0oFztqBMiblJl9iKmWyGby1Nlfce/DGMkGkkGcggiUUjYXFR4C+z9ptA== X-Received: by 2002:a0d:d78c:0:b0:56f:ff75:abcc with SMTP id z134-20020a0dd78c000000b0056fff75abccmr30306915ywd.29.1687835720566; Mon, 26 Jun 2023 20:15:20 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:20 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH v6 06/33] mm: Convert ptlock_alloc() to use ptdescs Date: Mon, 26 Jun 2023 20:14:04 -0700 Message-Id: <20230627031431.29653-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 70C6BC000A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: qmm7wpb6jsjbnkztxddh31tje6f68gyo X-HE-Tag: 1687835721-782438 X-HE-Meta: U2FsdGVkX19mHhmKtZb3G3LQ4BiLuSoUGdDjBYfDvDunT6Azh2RaP3szkuylTHGpQmiajgko2ls3YvV6PJihS7Cq6QA73bqQj11/n3FVbEcmVvYa268jj5Sm5AXLREQt9+u6n0RvIAkDj4+eZAfnayUiM9YWsLP9h5fL/UXmgn8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/W3TYCnyXT8SxogwnU26DhZOrhhTXnctnoRKrCKoN/PiK2WSfO3zHaM/i6AC/fBRMX7YSzU36U8F1pBkTLiKxaWTw7iHsIw/woODzGn0/Zm0BFRyVxoVFNlsRKFSPq/S9lGM9Zdu3bb89vedibVsGIjeK8mT/xAbEAwzWFoBxYNt4bfBCOFym/oUENC77aNLMXH3IG1lfQdGmW6M3z7X7wJ8UuHF7T0izGOYL9RFSU0FU67Hqa61LXezwAl1BROXwPeSbb0DCKAZrT0KehOYl4XATBot0mfs7pUKaRXZgulpAZg++k4zheVrMAwHo0zX2EIYJ5NzT9FLZCcU4OAqprXwTh4cen15h9uyXGkOVZ184P9ONo6Kyv5HCd676NZA0eSjrwp1dh7extA= 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 6 +++--- mm/memory.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1511faf0263c..39b0a4661e44 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2798,7 +2798,7 @@ static inline void pagetable_free(struct ptdesc *pt) #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); -extern bool ptlock_alloc(struct page *page); +bool ptlock_alloc(struct ptdesc *ptdesc); extern void ptlock_free(struct page *page); static inline spinlock_t *ptlock_ptr(struct page *page) @@ -2810,7 +2810,7 @@ static inline void ptlock_cache_init(void) { } -static inline bool ptlock_alloc(struct page *page) +static inline bool ptlock_alloc(struct ptdesc *ptdesc) { return true; } @@ -2840,7 +2840,7 @@ static inline bool ptlock_init(struct page *page) * slab code uses page->slab_cache, which share storage with page->ptl. */ VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); - if (!ptlock_alloc(page)) + if (!ptlock_alloc(page_ptdesc(page))) return false; spin_lock_init(ptlock_ptr(page)); return true; diff --git a/mm/memory.c b/mm/memory.c index 80faf3e76232..2ff14f50c7b3 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5920,14 +5920,14 @@ void __init ptlock_cache_init(void) SLAB_PANIC, NULL); } -bool ptlock_alloc(struct page *page) +bool ptlock_alloc(struct ptdesc *ptdesc) { spinlock_t *ptl; ptl = kmem_cache_alloc(page_ptl_cachep, GFP_KERNEL); if (!ptl) return false; - page->ptl = ptl; + ptdesc->ptl = ptl; return true; }