Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp918535lqh; Fri, 29 Mar 2024 00:38:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVDiOrXSxj1q0JN43zhZa2/a4Y4dYqTqLok+r6TajR99aGjJm7sKMsJ0F7903u7JpYiTvc6ppfmzLSJ2eO/Z7tgOUsVQR/6zRjvAARv3g== X-Google-Smtp-Source: AGHT+IFupeSp2bAp+wtQq8EgCuz93nAWYxAe5XGoo3pav/S/YyO1HlJFiJzfhYYXWTQKgt8kTRci X-Received: by 2002:a05:622a:14c8:b0:431:80cf:5280 with SMTP id u8-20020a05622a14c800b0043180cf5280mr1561143qtx.27.1711697906958; Fri, 29 Mar 2024 00:38:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711697906; cv=pass; d=google.com; s=arc-20160816; b=0OEYGgk2LzuAb0VvjHq70c9jBuDsiNo+/gm6GGYxczQR4yB5fGUWVyR41mjXFatl7O /KncPajj6eV79IC5i4tDVfzkmSEnLzHlHYY2Inl9aXuxDU9UKVHHqVooVCqRKpB6mzJJ EaKm9jHkybCwYqLf+l80ZMkScHSkRjgBlxky0EKzvb7rUeYRihRcGLxLfhP8W2r+JHO3 gTB5s9vT+9MpG0x4ISMfqY1OCQLznnK4WIdLdGqZ20/c6YnKKgs1uzHrRJH8upfsrj6k cUhXMTDr59G8Fo3NVbOmq1p/rcYS2QVGeLai8bPqaddbshwySIjDcOhq4mGAgUQ5QqtF OZug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=UH6LjJfXkA91u7B+LxuK1VjYI0jSAUD0s0KZGUYpa9s=; fh=Si4/veXMiLVnKIzdahjK3KT3HdDlDAxgNoB3BPrkgNM=; b=Wp+JnTIOxYAk+EuXDgbfTz9nnYn4WXVQEa637ozPHwoe9gBvVmPJIgp0tbt4UGSDcW KryMxfVJuKVPHvJMEAHUtnYA/Z8h6qkLPdAaBATVVLJgg7CikE65LQh5rbhnz9CKFnN9 pYjx94EFrJe1k+44ArYcXzMU0Wt4InGVV83l6w78NHMsNre75P931sFvPq+Y+OaqP18x +PdJAvHQktJ8RCOdi+rrHPcj1o5I3iphXSLW5k0OjGBDetvWakQtnlHNdJ5rIVu9RULw LIIr0pUwMFopJDqxcwL+pKRmoYV2omj8zUSofxWPMKAiDl+DDE1hdZq+4dAZV4uWpfzV 3ZHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MKCxx4XL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-124252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ec27-20020a05622a5b9b00b00432c7306e0csi83803qtb.4.2024.03.29.00.38.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 00:38:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MKCxx4XL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-124252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id ADCE71C22B2F for ; Fri, 29 Mar 2024 07:38:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8353841233; Fri, 29 Mar 2024 07:38:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MKCxx4XL" Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E1B8405C6 for ; Fri, 29 Mar 2024 07:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711697894; cv=none; b=iryFtbKJKZ36xbuee027JopvXRCKhSsNP+rGvk5/aQew+bFx3BvkdfStYUHFDJOAD2sOkEDdx6JqH/c7WrZ8jxkB3rtGCZJ6kZ1mj8fsTMzdsczqq2QudDdmffgPFgVS9ctct70haEyItNvQTy2cTBMGpS7nSXQ0iI/Nlrxosq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711697894; c=relaxed/simple; bh=FUlOMVV+kz2YMNGT63W3yd2gzTWaCE9vrvtG+jeCVEA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=A3GHlXmo81KYtOa0kFar3effNCeRTVnXyz7T03Xt0AUlbxead8xgGGVsCVMPDzHvyK76PSd95kvoqNAk73w7AmxJr6+zd43SBke5IhnmbxFnXirDdG8MmB8wV4A87sHprXiqTR02+SnTXf5pWtJHFDnJWolDFznRFMjkg2v1KsA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MKCxx4XL; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e0bec01232so15430285ad.3 for ; Fri, 29 Mar 2024 00:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711697892; x=1712302692; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UH6LjJfXkA91u7B+LxuK1VjYI0jSAUD0s0KZGUYpa9s=; b=MKCxx4XLK8W5kJuZ7i2UBXqUzb3sk6xRwzuhZ8kgqZCGJXyaajPQiTYMewkAgYD+zT EIpeDyGsR5FS8n8IHFgyRpNqq0SKfj3hjuNETvFm0V2LJay2cC7X9j4abuANzJF9yl07 lgvTeY3nBFtJZFQQVsvAqYwhmXoEC/qxNu/zZsy+QSgNZeqFwicbusx48iZQ8hnj1Lh4 tSZsnDXySGj3ae7tQry06vNP79y0xSdEV/VFfgIirnf5Dys13BC4ozKoPOD8wlkitBUk bg6heR09KM9gvCN0pL24KpeWpQOD54n/IUOHSKy3zT/3sPHbBMVmeo+wwQDCU0h+eBR6 qMcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711697892; x=1712302692; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UH6LjJfXkA91u7B+LxuK1VjYI0jSAUD0s0KZGUYpa9s=; b=ZHdS6F6l9NUeL+IvTsqarXlmjQ/AQwkLu2XMpM58yTvqZVd1N8dKcxCeZQUTGJb07W KR/fDoz1lUb0GdZ7vYMAzWNhcjvuy6dwqOsRSk+drYjr5HFV5s4RFE/iEim3/zdaJIbA KIJWub+ZWo/Z2CtljVDgN6Ow5Vk/22TPwhCU3ggjAfW1X5NFgQ6x1KkIjc9pqBOCp9ue qsCkhQ6dPUHKyhol382kQrLIHO0vl5Y6tclPOcndIR48RKkJxWNpZ3SSn4TUEVKv3bzw zpPULOlavDzvsYT7ksYsBqmhBp1aVcXVUkGSuqaUOZ9mxe4OuXvdQQuQeKzzP/HR9ScR y8Ww== X-Gm-Message-State: AOJu0YwHH2utqJDplh3leJWLnJxdVUABdYv/IgxrSSkTMjA4Yse6cs8/ NvfXwTMpUQsggXG5O47Zf435EfDmObw9yZp6DSItucw72Dt1Ctep44uCDEwWCpo= X-Received: by 2002:a17:902:f790:b0:1e0:93a:e681 with SMTP id q16-20020a170902f79000b001e0093ae681mr1833427pln.58.1711697892361; Fri, 29 Mar 2024 00:38:12 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id h6-20020a170902f7c600b001e0b60dfe1bsm2844821plw.197.2024.03.29.00.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 00:38:12 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Barry Song , Ryan Roberts , 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 Subject: [PATCH] mm: alloc_anon_folio: avoid doing vma_thp_gfp_mask in fallback cases Date: Fri, 29 Mar 2024 20:37:50 +1300 Message-Id: <20240329073750.20012-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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) { -- 2.34.1