Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1908471lqz; Tue, 2 Apr 2024 00:58:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVL+YuYI0uAOk7UqM90MlBIhwG1sVTlcbYnBpkB0eT0avyk/kRjhoJEKWilxWRbB30wfBNhmM818qQfSlWUlcWZo4SdFnycPxzbT/y7ZQ== X-Google-Smtp-Source: AGHT+IEH8pU8BUItiXGL9gAZFgKwPVd15GXrmR424hfv2JgvMF9yC9c35si3pzk1pc0GfVAavdtb X-Received: by 2002:a81:9406:0:b0:611:5ff6:2608 with SMTP id l6-20020a819406000000b006115ff62608mr12698968ywg.28.1712044715426; Tue, 02 Apr 2024 00:58:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712044715; cv=pass; d=google.com; s=arc-20160816; b=T4Ji3TOvBzelT8LNqQvkkuhCAI7hJBI9QJDC1mp5HEzNY0mwMl3HNRP9+tdyYJgnxG ALjdXYz1c+J+5h/4JekcXq7LTXbx96qhyOXVmRUa4To4CmDmjJO1wG6AnFK2JAGIo7Iy epLYuGQWRHJ7luacAFnaQaxRt7nPnGne75HiS2+GFzWr89+H+l/IeO2ar+O+O8KaYh4J m+PrYTG8uBptKN4oDmjthxC35YSsjDjlwdmTxo27cfts2Bq6l+lc3kEPFHA6byxFYSEe mFQH++3/SBXp8KT71oW6LrwweML+7aeTnp2DPqrz9ENylys7/UhOjwH65MW2sIX+w4pQ c1fg== 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=VHbXqU2gAfogSIAohReR4z1aNN5Ffaxum9gz63/z7/U=; fh=j4x94ta1CUvcwOAoCKzn0f2n6K7COK5sbeNb/fsKaEw=; b=rO1Pam9Synq/KNxgrTKPyj/ZlFvorkysyeBpR9dTNX29w0y5oHSvBkILFLZME2S3nR WVPN8//J4MJvBOmiD0LkT7XJaHH+QYr7bDI9O90wxUD17ZncFGZr0VTcisXo+zZNiSp0 W56RRfO6Ebp/cJG9XDG4ge1PUqcMYMt99BiIXW9fg/YEI/Qq3ragjYphzAPjMTut3ZZc SCfTBrs26Zc+YFxQ1hoOepkj/vFucANzTkeSlADPul1ERUlhpLV/7yi9v8ydgbaPqjDE 0gj3Db9ETZyCaOulC6EmVazubPXtujc26VXH64NJSytIwfj43wqZZHPlUKASsvt/LZBq LeYQ==; 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-127522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j5-20020a63cf05000000b005dc87f9cc78si10746147pgg.556.2024.04.02.00.58.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 00:58:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::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-127522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127522-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 00AB728304C for ; Tue, 2 Apr 2024 07:58:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F1733D38F; Tue, 2 Apr 2024 07:58:30 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E7B92BD1C for ; Tue, 2 Apr 2024 07:58:28 +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=1712044709; cv=none; b=IskmnUKkbgkxSZC6HktM1fejvs5HgC5kkqBGu04+wxBEzCBaStJE531OWyu2d8LF8V8QatPHTnasOQLuvZX9bpwZHEGhhgSIZfydK9BO6TRqCxkDfs6IiSFWjtJDa1cq+3qN9SPCcEWGnVlMMjVZifde+vaBsuXVHT8SRPw0lOY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712044709; c=relaxed/simple; bh=Iu2KxyyynVxbq6gjxe89goGC/9h4PqUNeJWtGGqhlqI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Yg88Das6WXQg0APUnbZNFrG7aNfwBXW6B7kmqfuXDPdBUrDPG52b5JyLW8WS5gSN6C35V16zoCT95VfKeECCZQsfVe33VzJ/1ygJdMMpg+cNw0OMdN8gVMaaVGwzFcZmFNJmWL/JF7wyogntwuvEU1bl0bsZddcdp+jeLpuROc0= 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 8516A1042; Tue, 2 Apr 2024 00:58:59 -0700 (PDT) Received: from [10.57.73.65] (unknown [10.57.73.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E991F3F64C; Tue, 2 Apr 2024 00:58:23 -0700 (PDT) Message-ID: Date: Tue, 2 Apr 2024 08:58:22 +0100 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] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases Content-Language: en-GB To: Barry Song <21cnbao@gmail.com>, akpm@linux-foundation.org, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Barry Song , Kefeng Wang , John Hubbard , David Hildenbrand , Alistair Popple , Anshuman Khandual , Catalin Marinas , David Rientjes , "Huang, Ying" , Hugh Dickins , Itaru Kitayama , "Kirill A . Shutemov" , Luis Chamberlain , Matthew Wilcox , Vlastimil Babka , Yang Shi , Yin Fengwei , Yu Zhao , Zi Yan References: <20240329073750.20012-1-21cnbao@gmail.com> From: Ryan Roberts In-Reply-To: <20240329073750.20012-1-21cnbao@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 29/03/2024 07:37, Barry Song wrote: > From: Barry Song > > Fallback rates surpassing 90% have been observed on phones utilizing 64KiB > CONT-PTE mTHP. In these scenarios, when one out of every 16 PTEs fails > to allocate large folios, the remaining 15 PTEs fallback. Consequently, > invoking vma_thp_gfp_mask seems redundant in such cases. Furthermore, > abstaining from its use can also contribute to improved code readability. > > Cc: Ryan Roberts > Cc: Kefeng Wang > Cc: John Hubbard > Cc: David Hildenbrand > Cc: Alistair Popple > Cc: Anshuman Khandual > Cc: Catalin Marinas > Cc: David Rientjes > Cc: "Huang, Ying" > Cc: Hugh Dickins > Cc: Itaru Kitayama > Cc: Kirill A. Shutemov > Cc: Luis Chamberlain > Cc: Matthew Wilcox (Oracle) > Cc: Vlastimil Babka > Cc: Yang Shi > Cc: Yin Fengwei > Cc: Yu Zhao > Cc: Zi Yan > Signed-off-by: Barry Song Reviewed-by: Ryan Roberts > --- > mm/memory.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/memory.c b/mm/memory.c > index c9c1031c2ecb..010e7bb20d2b 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -4353,6 +4353,9 @@ static struct folio *alloc_anon_folio(struct vm_fault *vmf) > > pte_unmap(pte); > > + if (!orders) > + goto fallback; > + > /* Try allocating the highest of the remaining orders. */ > gfp = vma_thp_gfp_mask(vma); > while (orders) {