From patchwork Mon May 1 19:28:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227926 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 CEFAAC7EE24 for ; Mon, 1 May 2023 19:28:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD483280006; Mon, 1 May 2023 15:28:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B602F280001; Mon, 1 May 2023 15:28:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EB52280006; Mon, 1 May 2023 15:28:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 81B20280001 for ; Mon, 1 May 2023 15:28:47 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 397E6AD258 for ; Mon, 1 May 2023 19:28:47 +0000 (UTC) X-FDA: 80742673494.23.AF036EE Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by imf06.hostedemail.com (Postfix) with ESMTP id 5F9CE180005 for ; Mon, 1 May 2023 19:28:45 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=roKi10VJ; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969325; 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=+5AaOHEPf+h0pPpRdylr/G5bcmt7vW9RVYKqYfsRH1I=; b=WtAD1SVjM74cs+t8NfihTLH+OduL+KW5PqMGBO8Z8R4sV5D/lBuDC/TEbV1w3fxZKMZu7O DdoryMJ654I+LMSOH9w460ujDkUkNpDUTz3OzV8TxF/VmrBTJgLBmiJe90+5XopMkLvE6G aszytrx4K4FfVGB6jFeVfLB4tIM3yzM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=roKi10VJ; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969325; a=rsa-sha256; cv=none; b=CsdrEJkR2yy+GcV6FQEAZMmB/neDQvozKVQ2anbiKbVqy2QWvXspjRU8WMr1K6mNpt9yv5 9dFDbcmLJyv8YOEh5P5MsvYr+DxoEYPkoxlHqL08ARo50q6490uELvusTmukKVx0qO3Pen hdo402DxmQlzy3uJ6B6mnnylouTYBWg= Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-63b51fd2972so1993220b3a.3 for ; Mon, 01 May 2023 12:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969324; x=1685561324; 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=+5AaOHEPf+h0pPpRdylr/G5bcmt7vW9RVYKqYfsRH1I=; b=roKi10VJs9dRiilqVeW0uT+zBJLQBRTUlVbgvCysCoLkLcBaFtSDJFWEbNs2bywIGo H3vsreWJ1ZpYCtBmz7ULTfsdWW+yedXBXQs/IwteaEsgFryEWzy4p352hRLq6aefxJE1 6kRZZ9T8eU7cXFjWBj8Pc1GfIk6+0XR5y+mT0ED8uGwr4lyimQw2Z0aiiwvL0/TUCnLz 1YAzhf+9hpLKk/t8M1Z7w1Ox1h7cTnYF1yo9NW5nVgHqgkVIivMOhZpN29c9g57SmIug sEztd2i0kQBJZgz4HOMkQSUf4qdi6lxWXkVGt+hsJgx7i60d4BQr0JdQ/AyxEv6LKtIb /zeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969324; x=1685561324; 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=+5AaOHEPf+h0pPpRdylr/G5bcmt7vW9RVYKqYfsRH1I=; b=EQksqvCsavTMYyjrSoYGVJmMxnIC9fTox9YTKuGEOj6m9MI63AwReNNizY8+DNQAvk s1UUWu8jiCW+ny5K2FalfdRuoLVDmFPYug329a5xS6vNX+dB1s2P5Hp4JjukeibGsr1a yOnjJl8u8axzqf04mcPJzurqqwwShPDDkz8H0F6+fnC7JMhFBIjx8aJsHrhkOXxwlyu8 Z7cX58vuh6z7R18G9Pp6DCGyY18+J3ST0i71CrqHKlq2U5QzXmfKf7lFe9/gWsICFmwJ QJtcsAfScEWA4LiIjRzDlpO3WtCdTmIWGndBT2Eu9qp9yDcMncGKhGdskCzufDMJa+Kw tHAQ== X-Gm-Message-State: AC+VfDwviTfXtBQa1dTj58J8dqcJy8iT+Avczj1DH/eEUL551bUHnQcZ ytqM28/ZAQV0evX5XGwrIlM= X-Google-Smtp-Source: ACHHUZ4PPvDcr1ZSfGKsFuoX96n8X09PGID8nEMj55TFVd8R4rz9suoKbv6A+ENi8FZ5wQLN727S7w== X-Received: by 2002:a17:902:ca0d:b0:1a6:5274:c1b0 with SMTP id w13-20020a170902ca0d00b001a65274c1b0mr12751445pld.60.1682969324101; Mon, 01 May 2023 12:28:44 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:43 -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, "Vishal Moola (Oracle)" Subject: [PATCH v2 07/34] mm: Convert ptlock_alloc() to use ptdescs Date: Mon, 1 May 2023 12:28:02 -0700 Message-Id: <20230501192829.17086-8-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ytzyoihqgk6fzxjpdhzmygyjbtx6ob56 X-Rspamd-Queue-Id: 5F9CE180005 X-HE-Tag: 1682969325-796200 X-HE-Meta: U2FsdGVkX1+3xXPr3kyEjEFqDT1VETaNE5XJZZ3KA/9Ybw0H86esArw6J6EZaTZrGMPnnnUqL7Ll/1SO5sRBOhYPdxijrvWugPPHuPzV0NG/Xs+RElsQpOlV2Rq07P/0HMUIFEy2itK33dR1zKGDgkNvc+e7x0D2nf52ESwERPCcse4v08GXMs5WHmSexD0JWCfBkG/3pYqJbk7VJ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5Q7+UhnTH+nmReZaQrRLJfGoV+b8IJd7bpjmU/ze3GD3rT/YQ/l5CAbJDAm0a7AHYHAMPDDMer9qpLB5Y/HnePGVoybmxQ/W6baOque29DX/pngSJt40+6AtNk5qPQF0LWPFhEMqaUJ2+gOlb4D0PDsAej4J6GLRvLXQ7xDzsAHrDG2mswrK9BDUdJ8VRaJuOcocNKCnRW4mjjfblQrBX+CLsbAy/OIIoP+gpl0hkct/3PQ7yeeg/R3kjUdZ6rDFUWLRPC4/oIXYgtCOwbREp8= 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) --- 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 62c1635a9d44..565da5f39376 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2786,7 +2786,7 @@ static inline void ptdesc_clear(void *x) #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) @@ -2798,7 +2798,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; } @@ -2828,7 +2828,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 5e2c6b1fc00e..ba0dd1b2d616 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5939,14 +5939,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; }