Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6088597rdb; Thu, 14 Dec 2023 08:03:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkh7/2y+PTiiKAHh/8+wgCBzyV6TMxMFxr39xh+agC/b0cRgPtbeHdnE+9YblVHBKWdbrn X-Received: by 2002:a17:902:e542:b0:1d1:cdb2:a93c with SMTP id n2-20020a170902e54200b001d1cdb2a93cmr11536833plf.130.1702569819267; Thu, 14 Dec 2023 08:03:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702569819; cv=none; d=google.com; s=arc-20160816; b=yUH6CxaOUJMnqAv2GYEsTZK+k2SsbZa5KidTKdTaWJCufzy7mDBTchkDYA4hqB3ReZ NPgQsNc+EEDg56x6Q5zLyJHYve7D5+o4qRTuz0gUgLfISQqp2Cg7Cted4RZzqZczot4u P3uPsSBWSbu3zb/FFDIkYXic2YYr3UStYP2GIEd/JYHekDXhia5IJbsGCnITCtRKxP7N mIy0wlIoxkT1sW7ab70D9Nd3YxrcbT3Y5qVHyCXzegr5ph6EFUqBE7NSu2shBiP8wJlE tjKBNRqzEMbRNQ8jwa/6HIYmTSU36DTmlMvG3sbKeMFBhB/0VlkgyB1qwu8Ulwrun1Kv e93A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lnZNgvR6EEyZzyqYZW3gbAAbM+SXBGR3kU6QEfSIFsw=; fh=YJzRHcAsLBTUkkyU1ib72V6YGaR7mzHX8BviksrDWzY=; b=fxyhODmieNo7mnsqSgSTiZle7bcI4MCmAAR3YtsrREMgV21HrJGujGgaEQtW8oSX5d 1Rtxk4TftxuvCdxcLtcNf9N+H5FoTAbdT/USCMqjXXMN5u7IqnAOEHVxsAj3wt6azH3P 6IhQiS6R9qdHqpZ3MJie6rhkOZe4Gh5WTSVK1d3jam03J35/Yvr7NfQH6SJS4/+M67sA QhbreoXrB5uRVE9k9xaIFKULVyl+RXJoGlL+G+5vunzjNLF8yGZSJQ9Hr1sAPHcCBBfm v5YnZqwcJXUO+UvPRiWKt0wvojW1xw8RTYIbWH9UZ3A/GRxnFQMvpAKmU5kVqvf5myqV MyCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t8-20020a1709028c8800b001d069748938si11288676plo.105.2023.12.14.08.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 08:03:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 6C9E78260ECE; Thu, 14 Dec 2023 08:03:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443492AbjLNQDA (ORCPT + 99 others); Thu, 14 Dec 2023 11:03:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230430AbjLNQC7 (ORCPT ); Thu, 14 Dec 2023 11:02:59 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72A5811A for ; Thu, 14 Dec 2023 08:03:06 -0800 (PST) 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 9E6D2C15; Thu, 14 Dec 2023 08:03:51 -0800 (PST) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B66C3F5A1; Thu, 14 Dec 2023 08:03:03 -0800 (PST) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama , "Kirill A. Shutemov" , John Hubbard , David Rientjes , Vlastimil Babka , Hugh Dickins , Kefeng Wang , Barry Song <21cnbao@gmail.com>, Alistair Popple , Dan Carpenter Cc: Ryan Roberts , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: Resolve some multi-size THP review nits Date: Thu, 14 Dec 2023 16:02:51 +0000 Message-Id: <20231214160251.3574571-1-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 14 Dec 2023 08:03:23 -0800 (PST) Tidy code based on review feedback for final version of multi-size THP: - Comment added to explain alloc_anon_folio() error protocol - ifdefery simplified for alloc_anon_folio() Signed-off-by: Ryan Roberts --- Hi Andrew, Hopefully this is the final tweak. Could you please squash this with the "mm: thp: Support allocation of anonymous multi-size THP" patch in mm-unstable? Or if you prefer me to re-post the entire series, just let me know. Thanks, Ryan mm/memory.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 8f0b936b90b5..3c530b639559 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4137,9 +4137,9 @@ static bool pte_range_none(pte_t *pte, int nr_pages) return true; } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE static struct folio *alloc_anon_folio(struct vm_fault *vmf) { +#ifdef CONFIG_TRANSPARENT_HUGEPAGE struct vm_area_struct *vma = vmf->vma; unsigned long orders; struct folio *folio; @@ -4199,12 +4199,9 @@ static struct folio *alloc_anon_folio(struct vm_fault *vmf) } fallback: - return vma_alloc_zeroed_movable_folio(vma, vmf->address); -} -#else -#define alloc_anon_folio(vmf) \ - vma_alloc_zeroed_movable_folio((vmf)->vma, (vmf)->address) #endif + return vma_alloc_zeroed_movable_folio(vmf->vma, vmf->address); +} /* * We enter with non-exclusive mmap_lock (to exclude vma changes, @@ -4260,6 +4257,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) /* Allocate our own private page. */ if (unlikely(anon_vma_prepare(vma))) goto oom; + /* Returns NULL on OOM or ERR_PTR(-EAGAIN) if we must retry the fault */ folio = alloc_anon_folio(vmf); if (IS_ERR(folio)) return 0; -- 2.25.1