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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 116EBEB64DC for ; Tue, 11 Jul 2023 18:28:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A01146B0075; Tue, 11 Jul 2023 14:28:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9B0E46B0078; Tue, 11 Jul 2023 14:28:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 878DF6B007B; Tue, 11 Jul 2023 14:28:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 780B66B0075 for ; Tue, 11 Jul 2023 14:28:31 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1F13E802D0 for ; Tue, 11 Jul 2023 18:28:31 +0000 (UTC) X-FDA: 81000166422.03.A0916CC Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 64695C0013 for ; Tue, 11 Jul 2023 18:28:27 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=CSH7LPGq; spf=pass (imf22.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689100107; a=rsa-sha256; cv=none; b=qHUA21kk045g0vjme88Lzf76FXxupDZ22fE+MG9g5XQfZF67/pm+9gGhMeZQifw6ptYDHD FjvMjVB3ipx2uf5ZCg55+W0j9PFn02mfJHZec2ZqJYEOQEtOhVqMDJ2CB4A7G5Bq/vXa5i VGfxV+Sy5/ghWvVRQd/LQjaJi6FJygs= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=CSH7LPGq; spf=pass (imf22.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689100107; 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=kttTOePECgSs6qM8EL/yKyOo4MXU6t6DsWuCut/cOno=; b=6rxj10JG0hd4JGMmKVSpAuw693d2Ey4Cv/ZF8Y7+XEKKbltkiBMJnFMD+RRFoQoj764rHT VVyr87KVR/rQTVgtjcMmHtA9yP/JOOSlH3H4TLeIU/+3Jm1ykgcWbklymEi3dXtACvDE0o je8NuBfkF+VxyrBymYBA82GnTJwBZAA= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7EB05615BA; Tue, 11 Jul 2023 18:28:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72E93C433C8; Tue, 11 Jul 2023 18:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1689100105; bh=Q63ErUhKx/B8A6oY/cTvhH9I36Jjdmsq5mKxh0Ap7gA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CSH7LPGqrEdpjtkdclZcxbTuw+ib2iklGOxdCpbY1snhbwHXsJ/uRKmSHrm57Uebr gx1PwFYI6t1Xovi1RBuiOvAxW4V3VDF6YKorvkJVhyx5AatHT0EqFMr4ug0++qI3mL KMRPTumraPS1vi63DCc4W7wjIIsMX4oLhq3cfaeQ= Date: Tue, 11 Jul 2023 11:28:24 -0700 From: Andrew Morton To: Yu Ma Cc: Liam.Howlett@Oracle.com, kirill@shutemov.name, dan.j.williams@intel.com, dave.hansen@intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lipeng.zhu@intel.com, pan.deng@intel.com, shakeelb@google.com, tianyou.li@intel.com, tim.c.chen@intel.com, tim.c.chen@linux.intel.com Subject: Re: [PATCH v2] mm/mmap: move vma operations to mm_struct out of the critical section of file mapping lock Message-Id: <20230711112824.e559065488b08ce649cccfd7@linux-foundation.org> In-Reply-To: <20230711172020.562250-1-yu.ma@intel.com> References: <20230711172020.562250-1-yu.ma@intel.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 64695C0013 X-Stat-Signature: owypcgzfjgxfbd8991p1y3psrenf4x7s X-Rspam-User: X-HE-Tag: 1689100107-998189 X-HE-Meta: U2FsdGVkX18n62IemBLqA0o0UdrFi0IExnAanPp6Ka7awhYlszdtQPmbNI6TdpO6qqVqlCCJIKk4V2nfmYA3rnNKIAG6lZEynFxEBjrTM5duVaLg4Xo4Z7fMem3HeaFO3nWKutJMAKsu8o4gT6q3+gf7Mw/Bo+VMy8zKc7J1mVkUCltX4NBzp79oVWGSa2jGHGTGW7Dn8XIPGRC3DNJwD6WosYpe6Uh5jLoJwLCBU2Ze6heRGD7k9nxdDzhDuEyDbnCBRtyUQbD2vtoPtQHw1xqtXXLO5rTwjKzW+ZDvTjFzVO8Vsj56BeeFkhXzuRTkdkk1taWkHCUHzLtcUyF46caaDlzMci7RFvvp9Kq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lo4pduCsJiYZ1Oi6EkjnYGmIMuEubo= 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: On Tue, 11 Jul 2023 13:20:20 -0400 Yu Ma wrote: > UnixBench/Execl represents a class of workload where bash scripts are > spawned frequently to do some short jobs. When running multiple parallel > tasks, hot osq_lock is observed from do_mmap and exit_mmap. Both of them > come from load_elf_binary through the call chain > "execl->do_execveat_common->bprm_execve->load_elf_binary". In do_mmap,it will > call mmap_region to create vma node, initialize it and insert it to vma > maintain structure in mm_struct and i_mmap tree of the mapping file, then > increase map_count to record the number of vma nodes used. The hot osq_lock > is to protect operations on file’s i_mmap tree. For the mm_struct member > change like vma insertion and map_count update, they do not affect i_mmap > tree. Move those operations out of the lock's critical section, to reduce > hold time on the lock. > > With this change, on Intel Sapphire Rapids 112C/224T platform, based on > v6.0-rc6, the 160 parallel score improves by 12%. The patch has no > obvious performance gain on v6.4-rc4 due to regression of this benchmark > from this commit f1a7941243c102a44e8847e3b94ff4ff3ec56f25 (mm: convert > mm's rss stats into percpu_counter). Related discussion and conclusion > can be referred at the mail thread initiated by 0day as below: > Link: https://lore.kernel.org/linux-mm/a4aa2e13-7187-600b-c628-7e8fb108def0@intel.com/ Could you please redo/retest this against a kernel which has 1c7873e3364 ("mm: lock newly mapped VMA with corrected ordering")? mainline, mm-unstable or linux-next. Thanks.