From patchwork Tue Feb 20 23:14:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13564725 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 CB173C48BC4 for ; Tue, 20 Feb 2024 23:18:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 375476B0074; Tue, 20 Feb 2024 18:17:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 338546B0072; Tue, 20 Feb 2024 18:17:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1ECB86B0074; Tue, 20 Feb 2024 18:17:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 12F216B0071 for ; Tue, 20 Feb 2024 18:17:59 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E2A474060A for ; Tue, 20 Feb 2024 23:17:58 +0000 (UTC) X-FDA: 81813747036.01.6851941 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf15.hostedemail.com (Postfix) with ESMTP id 45A9AA0012 for ; Tue, 20 Feb 2024 23:17:57 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WzyGwoOC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.174 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=1708471077; 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=BBH3LTjaBMSoYxUwPuTSep1EAb5H3OicE1Nmx6szstY=; b=3/xJbHLM/4pJwMvNxx/nqwGZO3UPjVCcvPG1ZFwwKj/5eKiuzijMMoRx9YwreRrJPyd3e3 qRdj/86/pdYcpb5tkC8p8Q840EHjfon6oXNNg3rZz4gP72jlyvZqQ8Q6Zb5EJBvI540+Fn vjC4+pYMc1DNKUbur396NeSb3p+t92Y= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WzyGwoOC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708471077; a=rsa-sha256; cv=none; b=kIWKJtbiYr7/nz9nHl5W9OsiiiQT4C7MulTnyixkR0eiZQgByi0bPf2YmrcKd6WKHyY8lE fiEjB7ykeDETYSffGtXz0Q59/0zcPdNwx10MR/cJj9NKYzFQgWtsKz1D5x7oNP/c8btbRx y9OxdDpxuaWoulKJvCC7v9xHJjiMJ5s= Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6e3ffafa708so3026876b3a.1 for ; Tue, 20 Feb 2024 15:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708471076; x=1709075876; darn=kvack.org; 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=BBH3LTjaBMSoYxUwPuTSep1EAb5H3OicE1Nmx6szstY=; b=WzyGwoOC4xNb86CuU7m+ZRY0HaysQ1ifukEQ/d4FOob+d+L7xF6PhGVBJ0fLPN1UsG Gy6VX2aBXCBt1dWLGyw/1vg4Qg2QlBZVj9FB1O0iL5lGJPIlGyWKhiT9BL2Cf3ATl5m9 BM9e7z85066SiC+FpXRv+kNVMlL5piq/Igt+raJ1rIN8VxqGnj4EUWvJpYPaGfRQGgxB 1iOJSUCyWt99DxlIHSCT1km9dfYJ+KmWXm5Q+ZbaNlalh9MvMgDwey6hEkfT3H3KDkdm S33qmJ4Y+G7FRsB86DhXMxXOIfJ27jbopGZQMWw/kh6WxmnjYUIRrd8Hhgo85R/cLu8w /fMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708471076; x=1709075876; 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=BBH3LTjaBMSoYxUwPuTSep1EAb5H3OicE1Nmx6szstY=; b=htXC3aJ9iRdet71nhbusdx7gh3jhLTnNH3U532cQJrPURGatP46H2fXcFC1fhILmrC xu2O1VStb1toDSKlllOZ3cKjg0QUOHCWc5LzC+hClgT7CM87SrJHRD4T7SFC0F6/i+6v w3tQkZak+PU4kINy9JCy3hT4FOW6oRgwUXtzPJfH2pydE5FNSrXFw1cDVZGbdGL90pdO D4cfzzNfEXoFhuScqnG7nfAjVja6QyhmrGaiWMUrj8cWzKaeYnRbH5wyuQD9wPnzXFsG t/+89ec/bqxysAs44ocZCizce7iKgTP+Ae1lsZTGCvQnk6/XeVBb8aGnK4Va2zRBq9i1 tDgA== X-Gm-Message-State: AOJu0YwJsxy9ZmmuR9hlcu4snpiDitHORnZV2m2ewt5wOtA5wMhHvcqS zc4dXPJbSGN2TYQGijdse6p2yRzYQwzc+E/Dr62dpkLXMhSs0u/G+E3K8++R X-Google-Smtp-Source: AGHT+IFeVa9iBxvsSpbEiIeYAtJicngo1Z4fESwQ2XBwkVGNXaE9jzVuGxav+9PKFoCevZ1IULDQ/Q== X-Received: by 2002:a62:c312:0:b0:6e1:338d:e01c with SMTP id v18-20020a62c312000000b006e1338de01cmr13801818pfg.1.1708471075876; Tue, 20 Feb 2024 15:17:55 -0800 (PST) Received: from fedora.. (c-73-170-51-167.hsd1.ca.comcast.net. [73.170.51.167]) by smtp.googlemail.com with ESMTPSA id x16-20020aa784d0000000b006e13a5ab1e5sm5317803pfn.73.2024.02.20.15.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 15:17:55 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, muchun.song@linux.dev, "Vishal Moola (Oracle)" Subject: [PATCH 1/3] mm/memory: Change vmf_anon_prepare() to be non-static Date: Tue, 20 Feb 2024 15:14:22 -0800 Message-ID: <20240220231424.126600-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240220231424.126600-1-vishal.moola@gmail.com> References: <20240220231424.126600-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 45A9AA0012 X-Stat-Signature: c6h3wf1qgxhpfcqit667ns6uhkxjstrd X-HE-Tag: 1708471077-511633 X-HE-Meta: U2FsdGVkX1/xjhZnf8h8tB/BZEBw3Ykq9OB4uX/h/DqnaxOkUFPoDGIuzBZ4aL/WZppVxhbF5sDKvJikjc7RxGSpPATL4ZnqTJhTQBg8elujoI0W6czXN2apA55z5b14e0ECEuv/vUm8JShbV78GxZmmdJ+WUODmfPc4vx6q2EqATn86UnuK2xHcMOfTNEQBFKM7OIRipovECSfk3FY9328lJz/fzBaunrow7YCyHvigSsN7Ik94Jw1lFTlZ2BHVKl0ojMZ3L6XCk2Q2aifuAE6bjYxRYHavj1CBmcpTSrVFBlgIpChrkGeJiQhYl2ie6hOStgnTL2/b0h5hc8yQSwZUfoQC1v3Q11KCABQBKH2NvbhBcip4lgje30lJYSx1stxSN+ljpW+epgGxmBr9j0PQvuy6PSyZBYmFuVd/33XAcA1vYD7SzkCXHn7DS+ZRwIcN8UUoH4nE95I53lK3t7MsZejJLAThsnqrJwf7VtFoE/xzlGX38B+b5QJY7Kcw3U3nQA0TjVIPe5XBo+ws7+uJ60UEzXFcRQSk9sXr56i9F+zw6lnttR85pp4NXP2LODRvHFdo0a2ETBwJpgok+erWhgTddMSuZXUy11JdI0wOY/FUnjiPubqRk2G3RR++kdE9++AKvAAZQSA1mEr+QlAYAXyjy1w8xWT7XErfMUQjSKoqkCvNdDVEgedybNPZri6GtPduS5BBeP6TgXJM1BswVE6/4UoNL27qBQ2AQXA35T7pGN6uhPwWO4b2fAznGElIXDnUGtNTtG1pSuhv78euzOFaR+sk0Z+JuFrN5oQ8SfCZP3rTqXNKlpNqEm7pRqMp7R77ZATZAPCjh3uzT/Q0OSO9TpzJkZfeLgI/IfGR7p1j9EA050VPlSirM4o0h5Czu/fyy5vxyqJmzKATvqtjryxBns4e4mO893FlAR32QwNTlR1JVTwRsgyp8nn58Hs4N7Z3X9sstOmgFBr wZuILBfo J54sdv+/HFWhhC/UYMD547rrxu6hWmNEnzCgwQ7zMPRSqc/ro7w1eOm6mqoXEnbRHdCbdYLHSH7/sCSEPlgBOk+8t4apb9RxdwEn7QXzg3Z9z1HnZAxHnVl0WaLWCUt0SKxtwhvw7j8CZOb4SVfD3pwz4JE2pFlMpytnC+bqP39eU5HiEhYeEvtDwm3TXYa597tib0HeWYZgR4wW1wsuGKw3o/EBoqMWBlV4gGjOnH55hk4fvjFRRKVeNElkaJ1QfAL/31zwSWUeDiJI= 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: In order to handle hugetlb faults under the VMA lock, hugetlb can use vmf_anon_prepare() to ensure we can safely prepare an anon_vma. Change it to be a non-static function so it can be used within hugetlb as well. Signed-off-by: Vishal Moola (Oracle) --- include/linux/hugetlb.h | 1 + mm/memory.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index c1ee640d87b1..9b45edb6e303 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -272,6 +272,7 @@ void hugetlb_vma_unlock_write(struct vm_area_struct *vma); int hugetlb_vma_trylock_write(struct vm_area_struct *vma); void hugetlb_vma_assert_locked(struct vm_area_struct *vma); void hugetlb_vma_lock_release(struct kref *kref); +vm_fault_t vmf_anon_prepare(struct vm_fault *vmf); int pmd_huge(pmd_t pmd); int pud_huge(pud_t pud); diff --git a/mm/memory.c b/mm/memory.c index 89bcae0b224d..c93b058adfb2 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3081,7 +3081,7 @@ static inline vm_fault_t vmf_can_call_fault(const struct vm_fault *vmf) return VM_FAULT_RETRY; } -static vm_fault_t vmf_anon_prepare(struct vm_fault *vmf) +vm_fault_t vmf_anon_prepare(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma;