From patchwork Mon Aug 16 07:46:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Qiang" X-Patchwork-Id: 12437917 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,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 BB340C4338F for ; Mon, 16 Aug 2021 07:46:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5B0A361AD2 for ; Mon, 16 Aug 2021 07:46:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5B0A361AD2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=windriver.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A671C8D0001; Mon, 16 Aug 2021 03:46:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A16E76B0072; Mon, 16 Aug 2021 03:46:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8DDD78D0001; Mon, 16 Aug 2021 03:46:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id 722766B0071 for ; Mon, 16 Aug 2021 03:46:03 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 171DB1CFAA for ; Mon, 16 Aug 2021 07:46:03 +0000 (UTC) X-FDA: 78480160206.18.42B489C Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by imf11.hostedemail.com (Postfix) with ESMTP id 01727F006299 for ; Mon, 16 Aug 2021 07:46:01 +0000 (UTC) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 17G7cStq022466; Mon, 16 Aug 2021 00:45:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : content-type : mime-version; s=PPS06212021; bh=VNFDYJ9aWy2zB03hgEyG8T/ANdmB5S9fgSDqfrhNYuM=; b=g9QpKzuONhM0+/ncKK7vXqAAdkas4Uqx2tIfZ/bOvVjJcde/l7rDnzJqtJHXG6/NURFx MawyeEY5rHW/UfdU9/b33BniyEdziBjFdKMhO8SW4x7oYfA46vjp9WDm1nMjM6r/N1UI jZuEsGgA4upP+eaU+hvlyKLky83WbfQkDL/6sowA2Daq/ax4Irp8PFiLIGOHjEmKPqvz 3GdzYD5yzOa61f07D2e8voMy4e3NIUM9IgQJBau9+CR9gClgxYNoGS3c0SxnPtm1S8yr ZJqt9tpzPCO1OPpiPJMITOMj3QyynUNshu51Ta7Tv/n1y6pmpd49PAZMJqG6oMLpGrVZ eg== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by mx0a-0064b401.pphosted.com with ESMTP id 3af7xwg8we-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Aug 2021 00:45:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TG60ncKKCE4oii7iMVtCWm2Mg52nQu7m+W4JWf4l9BQIeUIKU8fYVLaa7QgnUmrdBQQS86hY699ki4VbctK2ZGBztIs1qLyPUz+j0Otscj6ZO1jhVQlICqIPe17GUPlLzrU66KoNm/mWzgVyO+1Yurm2SqOr0/YfcaEloAU63i8l1BD6r8oF3CQs2Sk6JKe9mAAowc5LVM0o/UCrHwTsqpiY+f+tikLGlqPidCYauOxVqpG6yFZAPpsxzVKMi947NCXYcofH/x9G57wmoveVtG/xkv/jGurXiijTGjB2jeiFoZFco600b993d3O5es0jNy7H+HvYDebVLqRL1/Oj3w== 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-SenderADCheck; bh=VNFDYJ9aWy2zB03hgEyG8T/ANdmB5S9fgSDqfrhNYuM=; b=budpxnL6/68+9L1K80wdi+IpfWFHMr8DK7KCS1xXlk2KMwMZNDE4ElhM11sKQE5j/77w7O8Fprihy49W4AbQllcgCSSwM/Lpbgc4Y6L/2tQO9rs1AkAWipNImjqPujtEyxRxlLtuInzQWYb2ZZ+Sg7p2VD+9C66ukywRPHYMKsf2gvYaOfUPugTC30MNWxuKRdPDKBXV4N9U2nsSbXW9d0oLLhNifON8bzrr9u9QkxmPH9zmEE3jL9R3GUVUS+IACw8myShy0gR3CL9t4irHHwFOvJbdMdPttieF/E8VY3iAYpU8ejTeOJZufAbMIqGJek5jV1idloFmeW62GPo8ow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from BL1PR11MB5478.namprd11.prod.outlook.com (2603:10b6:208:31d::12) by BL0PR11MB3378.namprd11.prod.outlook.com (2603:10b6:208:68::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.18; Mon, 16 Aug 2021 07:45:38 +0000 Received: from BL1PR11MB5478.namprd11.prod.outlook.com ([fe80::b16b:d6bd:fb7:457f]) by BL1PR11MB5478.namprd11.prod.outlook.com ([fe80::b16b:d6bd:fb7:457f%3]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 07:45:38 +0000 From: qiang.zhang@windriver.com To: vbabka@suse.cz, akpm@linux-foundation.org, sfr@canb.auug.org.au Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm, slub: add cpus_read_lock/unlock() for slab_mem_going_offline_callback() Date: Mon, 16 Aug 2021 15:46:05 +0800 Message-Id: <20210816074605.30336-1-qiang.zhang@windriver.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: HKAPR03CA0004.apcprd03.prod.outlook.com (2603:1096:203:c8::9) To BL1PR11MB5478.namprd11.prod.outlook.com (2603:10b6:208:31d::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pek-qzhang2-d1.wrs.com (60.247.85.82) by HKAPR03CA0004.apcprd03.prod.outlook.com (2603:1096:203:c8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.9 via Frontend Transport; Mon, 16 Aug 2021 07:45:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 96df479e-d44c-49b3-9e0e-08d96089d6d6 X-MS-TrafficTypeDiagnostic: BL0PR11MB3378: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:260; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7tShEkEqUZl2R00jlL7cYP687Gw+G7on8i9sceMKMFkAcxR6yD52elMqkkKd6wy8P0Q7Ty7xDV8YF09vOfUI3US7Qu4ly0/zBhrpChV3nm/JOlB+Fw++YMLoTI8j/vABFCtaP4HqplS5dGwHQOhfCXAGMaQotgwztmY0kI+w3AN06NRCbd/KFie2j6uG8Rt8Zs4XBdOwA94RcjbmiqnMxZyUGel3QX2jJsGDeUB9SNefEYXajyo1aXEQrxzfQZWI/CIN4w8Spm+PxVqaIK21mfH9NVcVFNWwCkaDwpNdsoT5va5RZVdOmX34BnBGtlQ19V/VftGrMJF+HpQ70P38nmPBUfMBGfUK7++exGu0dg8pEw/oHTEbs4Sn9xfOLcUlZbRYYmG9i6YnQwobd1iK8JH/5+hiaEf+qkQovC9fBSRkIY1/u1sijgebmPOsCCiFAC+XIsc/2FJS44F7r0kcBPrrv84hF6Mh6+M7/Zb1b8fg5p00tMsiJVrcjPdu2gIERNKeqXxF3YNQKDYAHKIXfLRMknislhTNjwP/qNzN0PN/JV/NzTW1Ws8mfArrz0ZyewQFP48zdhL7Uwot1VEcUrgEyxn2npZtvfWhvxHlFf/MWAD/TjtKOQreuofQY0W2nsM1EWT+mWsm0n9x/0GXBBhQMUluOCR5YxNd+7xTxqZ8Rb+1ZEdorYWbD3H1JhYHYNthtwSFsb4X0v25+h6cUg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR11MB5478.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(376002)(346002)(39840400004)(366004)(396003)(36756003)(66476007)(83380400001)(66946007)(2616005)(478600001)(52116002)(6506007)(8676002)(38350700002)(38100700002)(316002)(5660300002)(8936002)(66556008)(26005)(6666004)(6512007)(9686003)(86362001)(4326008)(4744005)(2906002)(1076003)(6486002)(186003)(956004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mMbanrz7dpgaklzyIEs5tnHbZMvYzpA81CNuvS5vp4c68fnf+ibE5+Vgwlmz+JypzBAeA5FBZSwaH4aCpw38p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0cT9NpoCw7QpDhqHiJMQW5KJPqDmO0v3ag+s+/Wk+TcE80GK4bgYKoSJ681bHVysdkMpnjp3b9fEgoNzZ83Lb8RXxsDiN5/ChPOOZ8ESY2PfAG9Uot4/6kkspUbD5/poSTtwmJLwJkiyHGhsOoW4CB/g1IpNyXQlUxRhSrFrLpH650o X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96df479e-d44c-49b3-9e0e-08d96089d6d6 X-MS-Exchange-CrossTenant-AuthSource: BL1PR11MB5478.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 07:45:38.4813 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fVFj35ByEN+3aKeXpUhDx2JN00QGC9IM50BcZQZE/ygmQnXn0NV1XyF1DO2Ezw49qhy/iA2v8zrzFb27sd6jeFAGX1m7SJ7gdhDJl9YStOU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3378 X-Proofpoint-GUID: GlMWnzJwvaXLCVFgA_ZKe9xwjeE9RaNM X-Proofpoint-ORIG-GUID: GlMWnzJwvaXLCVFgA_ZKe9xwjeE9RaNM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-08-16_02,2021-08-13_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 spamscore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 adultscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108160049 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=windriver.com header.s=PPS06212021 header.b=g9QpKzuO; dmarc=pass (policy=none) header.from=windriver.com; spf=pass (imf11.hostedemail.com: domain of "prvs=3862bd9cc6=qiang.zhang@windriver.com" designates 205.220.166.238 as permitted sender) smtp.mailfrom="prvs=3862bd9cc6=qiang.zhang@windriver.com" X-Stat-Signature: r7r31wm81pby8mcar8iqa7z5qarxrjw9 X-Rspamd-Queue-Id: 01727F006299 X-Rspamd-Server: rspam05 X-HE-Tag: 1629099961-668778 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: From: "Qiang.Zhang" The flush_all_cpus_locked() should be called with cpus_read_lock/unlock(), ensure flush_cpu_slab() can be executed on schedule_on CPU. Fixes: 1c84f3c91640 ("mm, slub: fix memory and cpu hotplug related lock ordering issues") Signed-off-by: Qiang.Zhang --- mm/slub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 5543d57cb128..cf3f93abbd3e 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4593,12 +4593,14 @@ static int slab_mem_going_offline_callback(void *arg) { struct kmem_cache *s; + cpus_read_lock(); mutex_lock(&slab_mutex); list_for_each_entry(s, &slab_caches, list) { flush_all_cpus_locked(s); __kmem_cache_do_shrink(s); } mutex_unlock(&slab_mutex); + cpus_read_unlock(); return 0; }