From mboxrd@z Thu Jan 1 00:00:00 1970 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) {