From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8CB7C388F9 for ; Thu, 22 Oct 2020 22:53:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4E42F2245F for ; Thu, 22 Oct 2020 22:53:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="O6OT7p9i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E42F2245F Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=fb.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D0CCD6B0068; Thu, 22 Oct 2020 18:53:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C6CA06B006E; Thu, 22 Oct 2020 18:53:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4E916B0070; Thu, 22 Oct 2020 18:53:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id 74CB36B0068 for ; Thu, 22 Oct 2020 18:53:25 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1F7DC1EE6 for ; Thu, 22 Oct 2020 22:53:25 +0000 (UTC) X-FDA: 77401064370.04.mask95_140a40327254 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 04077800B28C for ; Thu, 22 Oct 2020 22:53:24 +0000 (UTC) X-HE-Tag: mask95_140a40327254 X-Filterd-Recvd-Size: 4241 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Thu, 22 Oct 2020 22:53:24 +0000 (UTC) Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09MMiSIQ008606 for ; Thu, 22 Oct 2020 15:53:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=jCwwODX7YwrK220gHIqPM0Cu0J/BfkukpANadFRweU0=; b=O6OT7p9iIl6c9a4dpB5r0W1paZTT9NnFX/MN2WnY0i9b9xwSSFtBeOGVdupFRJaiVCQA 0iWfRntwU9X2HyAeo6YfFUAKBJdTtVCb9m5O6G1OKc+bFohoO0nLgEB5gBSyCzgPi4vV 64/VQWj5r+gBn76OiYB8L2UKDgNhkQnPoF0= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 34a57yx3fb-14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 22 Oct 2020 15:53:23 -0700 Received: from intmgw003.06.prn3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 22 Oct 2020 15:53:18 -0700 Received: by devvm1755.vll0.facebook.com (Postfix, from userid 111017) id ED8AD1A3AE4C; Thu, 22 Oct 2020 15:53:12 -0700 (PDT) From: Roman Gushchin To: Andrew Morton CC: Zi Yan , Joonsoo Kim , Mike Kravetz , , , , , Roman Gushchin Subject: [PATCH v1 2/2] mm: hugetlb: don't drop hugetlb_lock around cma_release() call Date: Thu, 22 Oct 2020 15:53:08 -0700 Message-ID: <20201022225308.2927890-3-guro@fb.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20201022225308.2927890-1-guro@fb.com> References: <20201022225308.2927890-1-guro@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.737 definitions=2020-10-22_17:2020-10-20,2020-10-22 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 mlxlogscore=612 lowpriorityscore=0 bulkscore=0 spamscore=0 mlxscore=0 phishscore=0 clxscore=1015 adultscore=0 priorityscore=1501 suspectscore=2 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010220145 X-FB-Internal: deliver 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: Replace blocking cma_release() with a non-blocking cma_release_nowait() call, so there is no more need to temporarily drop hugetlb_lock. Signed-off-by: Roman Gushchin --- mm/hugetlb.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index fe76f8fd5a73..230e9b6c9a2b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1224,10 +1224,11 @@ static void free_gigantic_page(struct page *page,= unsigned int order) { /* * If the page isn't allocated using the cma allocator, - * cma_release() returns false. + * cma_release_nowait() returns false. */ #ifdef CONFIG_CMA - if (cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order)) + if (cma_release_nowait(hugetlb_cma[page_to_nid(page)], page, + 1 << order)) return; #endif =20 @@ -1312,14 +1313,8 @@ static void update_and_free_page(struct hstate *h,= struct page *page) set_compound_page_dtor(page, NULL_COMPOUND_DTOR); set_page_refcounted(page); if (hstate_is_gigantic(h)) { - /* - * Temporarily drop the hugetlb_lock, because - * we might block in free_gigantic_page(). - */ - spin_unlock(&hugetlb_lock); destroy_compound_gigantic_page(page, huge_page_order(h)); free_gigantic_page(page, huge_page_order(h)); - spin_lock(&hugetlb_lock); } else { __free_pages(page, huge_page_order(h)); } --=20 2.26.2