Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1481885rdb; Tue, 30 Jan 2024 22:54:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkQXsZfMPkHfXQ3O40l86bn4tpnBwYtW8so0GnJseyazj29oiqbQgEoTdrf3QNXesip6b7 X-Received: by 2002:a05:6512:786:b0:50e:ccfa:56c3 with SMTP id x6-20020a056512078600b0050eccfa56c3mr434919lfr.34.1706684061583; Tue, 30 Jan 2024 22:54:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706684061; cv=pass; d=google.com; s=arc-20160816; b=jQqhO7qflbkjBMmIz69ny0BQIPeJBTePWaemSYdhHAToZsrqJ19HeFq+c6X3zStlpS 5wuhgE39xA7CQZrQVcmxIf4st8AxJusoBR4430gh5nJ4lBz4N0nBl7G8JdhVNYYHKJlr s/LHu90zivK4cjIh6tzmB6dEMtlzKNuRkpAZDWhn/pBAtxA0VfvFpt4oRJ5SPG8E/y9f O8eC/O/hNqFv9Ur18tKRw1llf3JUS8LR6Pr8rlKuUW0dMPyWYN2hfqKUB0f024h2eUD6 q/Wlz559U3c0+n/6lcfYozh5SmIZWycIi8AmoN34o5vWlhpgH8zGkexkiBp3SXqTGybk 9esw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=ss1y9GNNTn2GBVotEtC1Hwo0eWV73qboNMjT1J3hjr8=; fh=Dl3OiEP5AFBKUSYUh9Q+/EZ0O8cJtb7MLJkDgf+t+Ic=; b=nmScK5aNb9kRDYmUkDsGcE+bDOkWVY6pQrPF4TxKdUjDY9pjyI4n7IIG6PcBDiO730 wHtGZvAULGSqu1BP/1hnkO+Imm3CEeHcH7cs6tc4pUfC7GvNqLfG1ykCer2B2L47dsGK pyutBnxM0lEdL0mj89dTQqZewOLpIBqFlH5wafoEcatt3JLUEAFcXP6ZRpemCcjkDgyq PkY6/oHbvX8xKrd3ptg9VCR55i/X8af7M7voZ76D+Yl9557cxfnYif3JtY8Lyn3TjvBD K3DpRAA4BkSE8/R9wwVJ6aApEoYHJjCuf26eO7UP/wH9jMePyKoGR6twGrIHRljcwwMI AcrA==; dara=google.com 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-45846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45846-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=1; AJvYcCUFmSBOX2PIorGMI3SyH09Mrx2+XE3G+CQDtBxRwATUEmnDow97JIN7Sf6SjF8rEOQ9wle5SVRgiXjbrRhkPme1u0qxqCT01l7lHZfG3g== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id xo13-20020a170907bb8d00b00a35b1e2e0d0si2894952ejc.1.2024.01.30.22.54.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 22:54:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; 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-45846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45846-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5318C1F24C04 for ; Wed, 31 Jan 2024 06:54:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E02B42060; Wed, 31 Jan 2024 06:54:10 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F27AA55C16; Wed, 31 Jan 2024 06:54:07 +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=1706684049; cv=none; b=Tzi/JYdUl4ByHEyOE6a+Bz9Fz3XmmwgRKIXBH8rXDiJ4RWkRRmy5phRg4pKSrkJqSNgeyCmuKMXlWdBjbnnoKaAytodKo/odTa9oQt1wpbgKOXcyEXq6FsPPnUKJm2xU7xTZvuGRJv/SB3x8JKoTQbn8Hf+WpYZ1sJBmyZiAnn4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706684049; c=relaxed/simple; bh=Zdw5BUWFSFm+QflhlaaAobfZNFzFMokg/6LaDvxnxVI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=DEMQ1dT+Q3XnuRm+klkE1WzonKDXYMbB3PRnwMfxjwjhofBphcu2O2/WQW3bpLjg88kkrXSNY7pUZ+ccCH94Nb7P60dJU1kbJC1Bc8uuwDasPBfTLwgrxKznfrsuwg4ZdwawaYc1QsW0jZY7dRu1bhv8aEqEpwkiPHKHqzlkn2A= 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 C3D5ADA7; Tue, 30 Jan 2024 22:54:50 -0800 (PST) Received: from [10.163.41.195] (unknown [10.163.41.195]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE9C73F5A1; Tue, 30 Jan 2024 22:53:53 -0800 (PST) Message-ID: <7612b843-cd31-4917-87c0-c26802c5bef2@arm.com> Date: Wed, 31 Jan 2024 12:23:51 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC v3 11/35] mm: Allow an arch to hook into folio allocation when VMA is known Content-Language: en-US To: Alexandru Elisei 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, pcc@google.com, steven.price@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 References: <20240125164256.4147-1-alexandru.elisei@arm.com> <20240125164256.4147-12-alexandru.elisei@arm.com> <1e03aec4-705a-41b6-b258-0b8944d9dc0c@arm.com> From: Anshuman Khandual In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/30/24 17:04, Alexandru Elisei wrote: > Hi, > > On Tue, Jan 30, 2024 at 03:25:20PM +0530, Anshuman Khandual wrote: >> >> On 1/25/24 22:12, 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. >> Right but how will pushing __GFP_ZEROTAGS addition into gfp_t flags further >> down via a new arch call back i.e arch_calc_vma_gfp() while still maintaining >> (vma->vm_flags & VM_MTE) conditionality improve the current scenario. Because > I'm afraid I don't follow you. I was just asking whether the overall scope of __GFP_ZEROTAGS flag is being increased to cover more core MM paths through this patch. I think you have already answered that below. > >> the page allocator could have still analyzed alloc flags for __GFP_ZEROTAGS >> for any additional stuff. >> >> OR this just adds some new core MM paths to get __GFP_ZEROTAGS which was not >> the case earlier via this call back. > Before this patch: vma_alloc_zeroed_movable_folio() sets __GFP_ZEROTAGS. > After this patch: vma_alloc_folio() sets __GFP_ZEROTAGS. Understood. > > This patch is about adding __GFP_ZEROTAGS for more callers. Right, I guess that is the real motivation for this patch. But just wondering does this cover all possible anon fault paths for converting given vma_flag's VM_MTE flag into page alloc flag __GFP_ZEROTAGS ? Aren't there any other file besides (mm/shmem.c) which needs to be changed to include arch_calc_vma_gfp() ?