Message ID | 20230925003953.142620-2-mike.kravetz@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 CD686CE7A94 for <linux-mm@archiver.kernel.org>; Mon, 25 Sep 2023 00:40:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 275AB6B0178; Sun, 24 Sep 2023 20:40:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2008F6B017A; Sun, 24 Sep 2023 20:40:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02AB26B017E; Sun, 24 Sep 2023 20:40:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E1D116B0178 for <linux-mm@kvack.org>; Sun, 24 Sep 2023 20:40:48 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B50D0B37A9 for <linux-mm@kvack.org>; Mon, 25 Sep 2023 00:40:48 +0000 (UTC) X-FDA: 81273264576.14.803B25E Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 614E81A0010 for <linux-mm@kvack.org>; Mon, 25 Sep 2023 00:40:44 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=bl59Dt8b; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cItdVJDb; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf19.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695602444; 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:in-reply-to:references:references:dkim-signature; bh=E/x7mTYtq0AK43XWU8sgezCXfY3I6f53AD910fUr/7c=; b=L5lAxNUutMs0lFj4xz9Rh58zVLZWDK8GuoLwuuXJiulZcf+I+6rEvl0MgnakFMRAqYbTtY xzUbl/6mQo3XVuGNxs6l+BdvTmN39DBXfEKiSBvdExBdS0ymBEDicWwgR4toqNhB9m7Jh/ FDXImNZ4OQKvX+oBbH/Ma3y1s4zsvqw= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=bl59Dt8b; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cItdVJDb; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf19.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1695602444; a=rsa-sha256; cv=pass; b=7WsknAGt4aJPhU5nkR8jKbIsuBgXjHWxb5neYokYJxCmPAtZ5a/BmUSeJKCq/HeoqhxC/4 KVYyVle6TreSa5iTHpm7+mi+Q8YclODp7rvpJqJZW+Ox+hJj5IWkvWVn6c4chBljxjggP4 PfLe4eMEWEBE+S5Ui8sR0YCeSw7Kv7Q= Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38OMkBQE019937; Mon, 25 Sep 2023 00:40:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=E/x7mTYtq0AK43XWU8sgezCXfY3I6f53AD910fUr/7c=; b=bl59Dt8bk7PR84Rbqcv/sdCrimgMbMy3nWo8M72IV6ARW7ipkqtYVxlwjwtWyjzdrAvm GvaXAyCcwRnUqA3E2eIipSCwVeGIl1Zw1Swl+KWT6KO6G1ZLrxIMQ3gOT+Az9tU6JLjb xeeUhzeixQwSUo9Txkp0Bk6hb7NujkbyYfV0hnccwl6Nolyyct32p/Pa7kO+J0obqa5P QUOE0M5dwClVpcwDCZRhVImzMu38jsP6RoPQV9KlIqhC0U5K0qS0L+41mNVqj5V8FL77 9ebOSmmYffZcEY8Iy6kXSOndOemhGdAVkmCDI+ELj0j4SNMxq4HRJNY+KHJI0MQEAlZG 5w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9qmuae0r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Sep 2023 00:40:14 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38OMIAuk034921; Mon, 25 Sep 2023 00:40:13 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pf4184g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Sep 2023 00:40:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ckwdNHi+noSAp654ILw1G5ARO9n35tmokHSNp1GVhBQptzExWMizkuqKNrqfURs9WsdywjZe9cl19x6f72qhCIx/5jS3iKuffRvWWf6v1MNqxwEYEM7fpHzFeeAsg7BTPDrZ4qssp87VsRm73tDBtEAS0lBbOU/FI4m/AZlNC4JFaVyomAPVgn6NK6dJR0l8DYYuDwfaFDAo0w6hzPLAlfu0w6myhXFlHmH+csafdkEt+sCo0tvjjUc4SCimhZ6O9kabX6uwKddoxjBgkvfLOtQCDVIkByQ5/CTqGB0GVPttW4aOBwOP4qyqZzmMpPy7U+CqKRv3z3XVMp+D2uDr9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E/x7mTYtq0AK43XWU8sgezCXfY3I6f53AD910fUr/7c=; b=hjz3em6me0I3VketzZRqYp0veMDMs60f+oUOUdQ4R9kZGeAxLV8yddsf+CeRt+IjmuX21sUx7uh5IR/JeCnv9KO4Ajn1PrxZbP2+zPcYwbpD4vAtCU6uxZxjAS8BrNo+Sld0h6i/T1m1XwSEg8PS/kwTBvE9s+bOaJ0+sNLe9dfPV2Ywhlxir3/iyAoPmC+8WtSn3XS4/yvnuwlbOFopxel/SQb+GueZr1Agf0r8bXTwIrvWdqguKT9L2+TwU3cjkz8hslYkskl4LQ4vNpGu1CmNiqXJMYxeL1UpTI9Ug0k/s/eu/FUoD+R3zB+2nxFAGARjGP7zZfDH1GisWVOszQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E/x7mTYtq0AK43XWU8sgezCXfY3I6f53AD910fUr/7c=; b=cItdVJDbwHnl8rTvGlhc0gMUDjDFHSnIS3OwsAyLq6o+pFeGJ/UN0nZCKrHRqwn5Ok2gJQyjqyrmbltWEHWTiQmcDJtKNrOhSONamEUKOcEWB55Qb3IJwSblUJinzEVATOtYwX7VMLNbRwdFMEmbJ8znMpyg7dCF6sivoVyufPY= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by LV3PR10MB7819.namprd10.prod.outlook.com (2603:10b6:408:1b0::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Mon, 25 Sep 2023 00:40:09 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::c621:12ca:ba40:9054]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::c621:12ca:ba40:9054%5]) with mapi id 15.20.6813.027; Mon, 25 Sep 2023 00:40:09 +0000 From: Mike Kravetz <mike.kravetz@oracle.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Muchun Song <songmuchun@bytedance.com>, Joao Martins <joao.m.martins@oracle.com>, Oscar Salvador <osalvador@suse.de>, David Hildenbrand <david@redhat.com>, Miaohe Lin <linmiaohe@huawei.com>, David Rientjes <rientjes@google.com>, Anshuman Khandual <anshuman.khandual@arm.com>, Naoya Horiguchi <naoya.horiguchi@linux.dev>, Barry Song <21cnbao@gmail.com>, Michal Hocko <mhocko@suse.com>, Matthew Wilcox <willy@infradead.org>, Xiongchun Duan <duanxiongchun@bytedance.com>, Andrew Morton <akpm@linux-foundation.org>, Mike Kravetz <mike.kravetz@oracle.com>, James Houghton <jthoughton@google.com> Subject: [PATCH v5 1/8] hugetlb: optimize update_and_free_pages_bulk to avoid lock cycles Date: Sun, 24 Sep 2023 17:39:45 -0700 Message-ID: <20230925003953.142620-2-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925003953.142620-1-mike.kravetz@oracle.com> References: <20230925003953.142620-1-mike.kravetz@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4P222CA0002.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::7) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|LV3PR10MB7819:EE_ X-MS-Office365-Filtering-Correlation-Id: 04c8fb6c-2fb6-4baf-11b6-08dbbd5ff8a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M+MNXBIVxP/nIx9rcSF7+uSPNCzZQ9tYpsx5AMsZ9rAoNRGrF88IRuxCOjuLefGRe2td9Fc9Wsovl2XE6uRBKgNLF3MkZo5Eag7O5NiAAvfjOGCxsRU0QlQaDTGL2NQN5rxUFnKqQXKiswf8FmBKGoFH7WmzkHhT8eW79cQTGa59HVYPt+FRmnC0atMQ4lkQ9hGo9DApRZ7DGAsXbklEos6S0euDkhstdiVsUAUMP+bQGVp7hMuLl8L646U9zoMS/kyiGzPHbzlanr2vuPXUyh1nROxrTBMs5mIxSvQzYuPFacBGYviZ90HIvqjC92KmeSmK90I7dyBMpkIX3PIQ4c7rZuZmqI88g1ElcCE73hGEGEU3XqFQsTUeLTos5oBSmY2OPNp+H8Y9YnNjQaaF46ubd0+kRBWdbYhbTp+pR1nYmw/T8wllftxp1AkR8OjabZ7RRDUnmLJ18leLaw71z4I65l+VO3/t372J1p1XhCDSU+oQk6glLAnefgEt7W05tLNMuCQ/scAilbhV+JzapBoEUM6/ht+85E507SfKhGoA5bmk+WfHRscJnOezxxaT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(39860400002)(136003)(346002)(376002)(230922051799003)(186009)(1800799009)(451199024)(2906002)(478600001)(6486002)(36756003)(6666004)(26005)(1076003)(38100700002)(83380400001)(6506007)(6512007)(2616005)(86362001)(41300700001)(4326008)(8676002)(8936002)(316002)(44832011)(5660300002)(66946007)(7416002)(15650500001)(66556008)(54906003)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /uFzmrdAFWSTH0uTAF8xy8XKBkuLa0+QrZf0mcw1PgrtBQ4DQCeKV2cPCDtIMGCNDy2lZcG/3y9OpdPJ3ZRCS+kJ3cSvHwL4GQnZ/uaHOdfCWmRhhtCuT4Vvhn4Idsj5ABgBBS8ciH6gD82xYVxNObAyMSR/BmwtkNVOp8rbh++Nv72BwZb4LPp9Z2ys7qGzr+kJLZafPVlpg3kdf0xUlMzs0jhrbnJBmhaCARCZgddYCB+u0xSmHhzJR0J8gIU0S5S1+e4+/GHGpV8OCLWcrOgtzueIEj9jKAVK8O0O4j8Q8JhctC6F1U4vdnCYJq+1+aV722QY6+aKGE1ZOCKHNkowKDxdZ5aT/ZMrB/COJykRtWpyutL513gLgo24Z7Ivzk7j7DG6hPCANixTnKPnPXqR0HZ7d7gQnBEwGzHR2QsX1JREe2Gdcn7xBDUXV+47UkTQ34nONa2q5BsppY871u8Ju48dNwf2Ha7u9mPYoaPwkw7qopqnWDvSc4J7EcjZ/U81Z0zjyXr6KgGPYp+o9hqz+v46UglRsSATEHMn5bncy1gwAmOtag2JsP1ORmAmleGu32QVD7kyEqkhQoLvm9RInx8XUuj39NlKskI34MFeoybMe8fvLILV+GbLsrTcld4pMBca5JCUPX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ginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04c8fb6c-2fb6-4baf-11b6-08dbbd5ff8a6 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2023 00:40:09.6130 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CBqM7Env+7t0Rs2aI8D6vJngdq6xQ1CSC/w98u2ruNHXZLjB8YWI+a5r41NfhXkLubV2Hig3S0KqOqfbMz+AQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR10MB7819 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-24_21,2023-09-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309250000 X-Proofpoint-GUID: NEeBp3iSSrbJTj79mHiI8-W2S2ERi9_O X-Proofpoint-ORIG-GUID: NEeBp3iSSrbJTj79mHiI8-W2S2ERi9_O X-Rspamd-Queue-Id: 614E81A0010 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ix1bwsze3uodoxznfeqq74znbw518gpt X-HE-Tag: 1695602444-557220 X-HE-Meta: U2FsdGVkX18a3pwrtZBJZUCq79TQlJxZafnuL7GPOCzul3hNl/fLYvqq6Zl7894q/ABqXLcdkcDoOztOBA5RXqyKzVDJ4ZgcebGgoa+RG3OYFdkh3cNZ+XxQm7EG3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0TtdRivdZrE7G1ID4aBiA0WxbqoSEMGhyAnFEuiCmu64QG/B61gTnvL3TeLTxSn6xF4GbGmzo3eFae1IYvzqbGst7Pa3e+RRsx1+MV/YZEpTCPu4H3+JunUOfVADXk9kDFjgoNmzRoSBvgneBQaHk0DmJqpq55PnaYmWrSA1bGc92+NOvwtYNYr3NMovqVtWR4EJIL9iOjfZBMhPV8Zwd3gLg98925Ms8+FOcOPfSwco++hVH9cd2eo3fB43RNeUGBdOPQvlWJC3/Cr/P4PanfMo9cqaqZrzieGC6NfF9qrG2rNTjT4ZYIIGN7DK1fIBFg7Pvmh+Pr 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: <linux-mm.kvack.org> |
Series |
Batch hugetlb vmemmap modification operations
|
expand
|
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index de220e3ff8be..47159b9de633 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1837,7 +1837,46 @@ static void update_and_free_hugetlb_folio(struct hstate *h, struct folio *folio, static void update_and_free_pages_bulk(struct hstate *h, struct list_head *list) { struct folio *folio, *t_folio; + bool clear_dtor = false; + /* + * First allocate required vmemmmap (if necessary) for all folios on + * list. If vmemmap can not be allocated, we can not free folio to + * lower level allocator, so add back as hugetlb surplus page. + * add_hugetlb_folio() removes the page from THIS list. + * Use clear_dtor to note if vmemmap was successfully allocated for + * ANY page on the list. + */ + list_for_each_entry_safe(folio, t_folio, list, lru) { + if (folio_test_hugetlb_vmemmap_optimized(folio)) { + if (hugetlb_vmemmap_restore(h, &folio->page)) { + spin_lock_irq(&hugetlb_lock); + add_hugetlb_folio(h, folio, true); + spin_unlock_irq(&hugetlb_lock); + } else + clear_dtor = true; + } + } + + /* + * If vmemmmap allocation was performed on any folio above, take lock + * to clear destructor of all folios on list. This avoids the need to + * lock/unlock for each individual folio. + * The assumption is vmemmap allocation was performed on all or none + * of the folios on the list. This is true expect in VERY rare cases. + */ + if (clear_dtor) { + spin_lock_irq(&hugetlb_lock); + list_for_each_entry(folio, list, lru) + __clear_hugetlb_destructor(h, folio); + spin_unlock_irq(&hugetlb_lock); + } + + /* + * Free folios back to low level allocators. vmemmap and destructors + * were taken care of above, so update_and_free_hugetlb_folio will + * not need to take hugetlb lock. + */ list_for_each_entry_safe(folio, t_folio, list, lru) { update_and_free_hugetlb_folio(h, folio, false); cond_resched();