Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp340053rdb; Mon, 29 Jan 2024 04:08:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGV1LgFoL1hSpLEnGRuly7WrqeaEqZ6akPT61DnPoxbinmwdpykl2aChKASOyC8aA2K/Z/h X-Received: by 2002:a9d:7357:0:b0:6df:b685:84b9 with SMTP id l23-20020a9d7357000000b006dfb68584b9mr3950673otk.32.1706530099283; Mon, 29 Jan 2024 04:08:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706530099; cv=pass; d=google.com; s=arc-20160816; b=0o01JNgNjf1ezOGGMT2oDIn+pYZJ2VPu2ckXCZRIsDrbL1QhDo3qqxP0c00qqHEU/y 9fH/A6cUJBYoBHynyBZaDQ+zuENrdaJMwDpih75qi9rgku1aZ7fKH4eAVZV7HI8txm0y z453q9t3y105tyb67Am8ETsAEwm4rjYz83Dh/d4ewKUjY2GmZzvedFJ6bR5zpGHzDwOe Lw9RjwXMzz6i+VlHUYNCAWcwOOMmmC7Iz9I9Vfy5IcvlMu7apEJzaNTw+ejX9SvSAAec 8mR9iZIGHBRLby7nRwE5wXtINyqhiIwaviFdfkQ3s66HD2rfDRuy+ZPgNZUkKESIZWcD 3paw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=OXbl0kT0jwzw5ne4ouhaQHXtVUQDb7lB3DjYgt2TdJ4=; fh=kiFa6QFgiDV9fTIRXvv7bZ3FmftpxgjwL8zUt1AKL6k=; b=MKhCkFIzChMmyemMoTA5cXXN0Eo0Rk5gTBfUkARhkItNoNr9U2a2+tWaO43hG3Pb4B WPcWGi3n6Nz0uy/G3Fo5tE6a8Jm08haLwCudYHbpSibVWnBBjg35QjArHkQjkAZEXWfA 6NBGyRdQdViorENx8Q/GfHIBRY0C3a3rQGRJcomYPTwyCATsQqu3amyIWFHiBEyVkDWj PZNzI0brkB79bMoG/bQ/28rTrxXM01JsqTttkqlcMEV8CXFzVqVc3trek6lWDGfgHq63 SbumpMHu32FbH+srtx7Ak6bH3n2oMUy2XV1l87zs3M8siBkKLHykM+cPzQOFoK6kQ2Di EiLA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-42660-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42660-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p29-20020a63741d000000b005cf19be1febsi5713204pgc.735.2024.01.29.04.08.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 04:08:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42660-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-42660-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42660-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D2D34B23F3D for ; Mon, 29 Jan 2024 12:00:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62158604A2; Mon, 29 Jan 2024 11:59:34 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A70D9604AD; Mon, 29 Jan 2024 11:59:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706529573; cv=none; b=oHP/DNRjXMoOLXKo3f26ZEnXd/YVA86ZoGYdiOePzoxahbxCHy7ggcxLajTT2PV3f3QdXxYmxWaOWRpma8EV6KAzwI1XKFofqZ72nxXeC2S1xJnXUtmu4Zi9R52d5lWlUM6GK+fxrGaKElhviUKKbP6WM4PYL/ANVVbfiv1L2VE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706529573; c=relaxed/simple; bh=g8VjbZmPPMmeZJ0+muiwD3pbzn3IrrJd/y/zYOa4JkI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YmhODcLWy+OOvp7lKPZiUi3t8HxOVjoJS60FHg8hplMudV6eAL82GdfmAjEu8p2F/TifNr+yb+gsBcMGGGE5GGuCW7PLp9pM5N23CwlpCw8DXiqmYkVSd4JA84wIQn0yG0ZzZ5OXnHdcKXm3EIDPjCzQ56HB0vkFUKQMn1iceFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AF0DB1FB; Mon, 29 Jan 2024 04:00:13 -0800 (PST) Received: from raptor (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7F6793F5A1; Mon, 29 Jan 2024 03:59:24 -0800 (PST) Date: Mon, 29 Jan 2024 11:59:21 +0000 From: Alexandru Elisei To: Peter Collingbourne Cc: catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, arnd@arndb.de, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mhiramat@kernel.org, rppt@kernel.org, hughd@google.com, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, david@redhat.com, eugenis@google.com, kcc@google.com, hyesoo.yu@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH RFC v3 11/35] mm: Allow an arch to hook into folio allocation when VMA is known Message-ID: References: <20240125164256.4147-1-alexandru.elisei@arm.com> <20240125164256.4147-12-alexandru.elisei@arm.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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hi Peter, On Fri, Jan 26, 2024 at 12:00:36PM -0800, Peter Collingbourne wrote: > On Thu, Jan 25, 2024 at 8:43 AM Alexandru Elisei > wrote: > > > > arm64 uses VM_HIGH_ARCH_0 and VM_HIGH_ARCH_1 for enabling MTE for a VMA. > > When VM_HIGH_ARCH_0, which arm64 renames to VM_MTE, is set for a VMA, and > > the gfp flag __GFP_ZERO is present, the __GFP_ZEROTAGS gfp flag also gets > > set in vma_alloc_zeroed_movable_folio(). > > > > Expand this to be more generic by adding an arch hook that modifes the gfp > > flags for an allocation when the VMA is known. > > > > Note that __GFP_ZEROTAGS is ignored by the page allocator unless __GFP_ZERO > > is also set; from that point of view, the current behaviour is unchanged, > > even though the arm64 flag is set in more places. When arm64 will have > > support to reuse the tag storage for data allocation, the uses of the > > __GFP_ZEROTAGS flag will be expanded to instruct the page allocator to try > > to reserve the corresponding tag storage for the pages being allocated. > > > > The flags returned by arch_calc_vma_gfp() are or'ed with the flags set by > > the caller; this has been done to keep an architecture from modifying the > > flags already set by the core memory management code; this is similar to > > how do_mmap() -> calc_vm_flag_bits() -> arch_calc_vm_flag_bits() has been > > implemented. This can be revisited in the future if there's a need to do > > so. > > > > Signed-off-by: Alexandru Elisei > > This patch also needs to update the non-CONFIG_NUMA definition of > vma_alloc_folio in include/linux/gfp.h to call arch_calc_vma_gfp. See: > https://r.android.com/2849146 Of course, you're already reported this to me, I cherry-pick the version of the patch that doesn't have the fix for this series. Will fix. Thanks, Alex > > Peter