From patchwork Wed Aug 31 05:27:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Liu X-Patchwork-Id: 12960412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CCB0ECAAD3 for ; Wed, 31 Aug 2022 05:27:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C434C6B0071; Wed, 31 Aug 2022 01:27:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF36B8D0002; Wed, 31 Aug 2022 01:27:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABB308D0001; Wed, 31 Aug 2022 01:27:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9CBEC6B0071 for ; Wed, 31 Aug 2022 01:27:47 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 51BC3160CCF for ; Wed, 31 Aug 2022 05:27:47 +0000 (UTC) X-FDA: 79858755774.12.F80E7F3 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by imf18.hostedemail.com (Postfix) with ESMTP id D13531C0019 for ; Wed, 31 Aug 2022 05:27:46 +0000 (UTC) Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.17.1.5/8.17.1.5) with ESMTP id 27V0pjRd002560 for ; Tue, 30 Aug 2022 22:27:46 -0700 Received: from maileast.thefacebook.com ([163.114.130.16]) by m0089730.ppops.net (PPS) with ESMTPS id 3j9hpwp297-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 30 Aug 2022 22:27:46 -0700 Received: from twshared2273.16.frc2.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 30 Aug 2022 22:27:44 -0700 Received: by devbig932.frc1.facebook.com (Postfix, from userid 4523) id 209EFC44FB53; Tue, 30 Aug 2022 22:27:39 -0700 (PDT) From: Song Liu To: , CC: , Song Liu , Uladzislau Rezki , Baoquan He , Andrew Morton Subject: [PATCH] mm/vmalloc: Extend find_vmap_lowest_match_check with extra arguments Date: Tue, 30 Aug 2022 22:27:34 -0700 Message-ID: <20220831052734.3423079-1-song@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: u13L8vI8tbem1YfDO_IymDnBHIjtguyT X-Proofpoint-GUID: u13L8vI8tbem1YfDO_IymDnBHIjtguyT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-31_01,2022-08-30_01,2022-06-22_01 ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none); spf=pass (imf18.hostedemail.com: domain of "prvs=0242d7ce6e=songliubraving@fb.com" designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=0242d7ce6e=songliubraving@fb.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661923667; a=rsa-sha256; cv=none; b=gqr0GPAsK/xyPNN/f+C3FqRzwBegf75MtEpv0lWmvTgRh3zGVot0elW99rU7idMSgbhSvQ Qv2C9ShaOl0snJ3IPQ8jMUrh/GOxFjW7Lqm/T5uuP5mr06M0BIvfTmL37oKi+P4rCUJkFD szJvgf8eDZFmd78dQ1QotlFtpGiecIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661923667; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=jHRxrafJmGe+g6JhMDzD1d7MnA3QGIhuBxHjnmX8Tkk=; b=4fTCPOzpRRsrr8Pee0z13a7zm9N5KDYWX3PTcSM8YZH8KkZ4yn2m8R0EVqkgEtX5osMQFe CcJbZpSaCN6BzMHJpvSDStM1tZjF77prtx+zK64L7wXuxRRqs3m4wqqL9ql5zKoykn9j1F 2TC73uVMgqM9qg35TKQ2qgvcFEsTrLQ= X-Rspam-User: X-Rspamd-Queue-Id: D13531C0019 Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none); spf=pass (imf18.hostedemail.com: domain of "prvs=0242d7ce6e=songliubraving@fb.com" designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=0242d7ce6e=songliubraving@fb.com" X-Stat-Signature: jy4nyj7dhn8z7z5zq33zytwq64iuu6rz X-Rspamd-Server: rspam08 X-HE-Tag: 1661923666-239930 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: find_vmap_lowest_match() is now able to handle different roots. Make similar changes to find_vmap_lowest_match_check() and find_vmap_lowest_linear_match() to handle different trees. Fixes: f9863be49312 ("mm/vmalloc: extend __alloc_vmap_area() with extra arguments") Cc: Uladzislau Rezki (Sony) Cc: Baoquan He Cc: Andrew Morton Signed-off-by: Song Liu Reviewed-by: Baoquan He Reviewed-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index dd6cdb201195..088b421601c4 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1300,12 +1300,12 @@ find_vmap_lowest_match(struct rb_root *root, unsigned long size, #include static struct vmap_area * -find_vmap_lowest_linear_match(unsigned long size, +find_vmap_lowest_linear_match(struct list_head *head, unsigned long size, unsigned long align, unsigned long vstart) { struct vmap_area *va; - list_for_each_entry(va, &free_vmap_area_list, list) { + list_for_each_entry(va, head, list) { if (!is_within_this_va(va, size, align, vstart)) continue; @@ -1316,7 +1316,8 @@ find_vmap_lowest_linear_match(unsigned long size, } static void -find_vmap_lowest_match_check(unsigned long size, unsigned long align) +find_vmap_lowest_match_check(struct rb_root *root, struct list_head *head, + unsigned long size, unsigned long align) { struct vmap_area *va_1, *va_2; unsigned long vstart; @@ -1325,8 +1326,8 @@ find_vmap_lowest_match_check(unsigned long size, unsigned long align) get_random_bytes(&rnd, sizeof(rnd)); vstart = VMALLOC_START + rnd; - va_1 = find_vmap_lowest_match(size, align, vstart, false); - va_2 = find_vmap_lowest_linear_match(size, align, vstart); + va_1 = find_vmap_lowest_match(root, size, align, vstart, false); + va_2 = find_vmap_lowest_linear_match(head, size, align, vstart); if (va_1 != va_2) pr_emerg("not lowest: t: 0x%p, l: 0x%p, v: 0x%lx\n", @@ -1513,7 +1514,7 @@ __alloc_vmap_area(struct rb_root *root, struct list_head *head, return vend; #if DEBUG_AUGMENT_LOWEST_MATCH_CHECK - find_vmap_lowest_match_check(size, align); + find_vmap_lowest_match_check(root, head, size, align); #endif return nva_start_addr;