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 0694AC43334 for ; Fri, 24 Jun 2022 02:39:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71E938E01BA; Thu, 23 Jun 2022 22:39:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CE7C8E01B9; Thu, 23 Jun 2022 22:39:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 595D48E01BA; Thu, 23 Jun 2022 22:39:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 45BFF8E01B9 for ; Thu, 23 Jun 2022 22:39:58 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1A2A420CB1 for ; Fri, 24 Jun 2022 02:39:58 +0000 (UTC) X-FDA: 79611574476.02.1FEC57C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id A23A61C0009 for ; Fri, 24 Jun 2022 02:39:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656038397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=v9YSb5G2vemrnnEESOBJoJ5PZIWec+fG22z2dXykH4k=; b=M/JKOIBigfJtE8EFouV3EzyRAmUi6tvqbotQhGuhjDR8XyKTFh42geOsO8EqMRdx0fQ4sH TtNbqja9A78IdAbnehnw+2N3pEfjdr81UtseF1OBvN04H1QcnaDndVPMjXeVQNFq9Xg1ld UeE8aoIvGNkNHgbzmp0TWqkPHZlT+QQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-264-pidpG-JWNeyOTg-QBMFg2Q-1; Thu, 23 Jun 2022 22:39:48 -0400 X-MC-Unique: pidpG-JWNeyOTg-QBMFg2Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BF72C1818D0E; Fri, 24 Jun 2022 02:39:47 +0000 (UTC) Received: from localhost (ovpn-12-66.pek2.redhat.com [10.72.12.66]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 893351121314; Fri, 24 Jun 2022 02:39:46 +0000 (UTC) Date: Fri, 24 Jun 2022 10:39:43 +0800 From: Baoquan He To: Waiman Long , Zhipeng Shi Cc: linux-mm@kvack.org, linux-rt-users@vger.kernel.org, tglx@linutronix.de, shengjian.xu@horizon.ai, schspa@gmail.com, Sebastian Andrzej Siewior , peterz@infradead.org Subject: Re: [Question] vmalloc latency in RT-Linux Message-ID: References: <20220621121547.GB37196@ubuntu20> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656038397; a=rsa-sha256; cv=none; b=BbgjXOhnb+VJi+2pLe2qrOALlJ0/K4+Y3hrvd+UvtGDuMu3WGq122Ahfb/VCjqEO8hlYHL FR2+r4GBpTrkbBJZ3mDU+1U3Y1hiw/aue7GWVnZaCMo/9y+XyHGWNeTy47jxSSB+Pw8txl 7aN/JYHymp13yAdJskW7y0iCPgT5ACM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656038397; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=v9YSb5G2vemrnnEESOBJoJ5PZIWec+fG22z2dXykH4k=; b=WtcYohBUvHGU68TJ5OcWZZn1eCtFYMqdAQEfFXvfP/C0n+yRWZaBwJGkB6Qysy3gqgQsJy 0S46waUUO9p64G8L9ZD1bmt9XREhAWqHbyC689usgulJvtik+eGAkr0Hg9WRFdb1feKecQ 5165knMDaUBPDaEFAGf04v79vkt2vrU= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="M/JKOIBi"; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf21.hostedemail.com: domain of bhe@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=bhe@redhat.com X-Stat-Signature: agazi4joxuef3ouem6dpuqzhc5xuig8h X-Rspamd-Queue-Id: A23A61C0009 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="M/JKOIBi"; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf21.hostedemail.com: domain of bhe@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=bhe@redhat.com X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1656038397-551234 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 06/23/22 at 02:04pm, Waiman Long wrote: > On 6/23/22 06:51, Baoquan He wrote: > > On 06/21/22 at 08:15pm, Zhipeng Shi wrote: > > > I noticed in rt-linux, vmalloc has a large latency. This is because the > > > free_vmap_area_lock is held for a long time in the function > > > __purge_vmap_area_lazy. > > > > > > In non-RT-Linux, because the function spin_is_contended is well > > > implemented, so there will be no such problem. > > > > > > But in RT-Linux, spin_is_contended simply returns 0. I don't understand > > > why this function was implemented like this before, but in order to > > > solve this problem, I thought of two ways. > > > > > > The first is to modify the spin_is_contended definition in spinlock_rt.h > > > as shown below, but I'm not sure if the change has side-effects: > > > > > > -#define spin_is_contended(lock) (((void)(lock), 0)) > > > +static inline int spin_is_contended(spinlock_t *lock) > > > +{ > > > + unsigned long *p = (unsigned long *) &lock->lock.owner; > > > + > > > + return (READ_ONCE(*p) & RT_MUTEX_HAS_WAITERS); > > > +} > > > > > > The second is by reducing the number of lazy_max_pages, but it will lead > > > to lower performance of vmalloc. > > __purge_vmap_area_lazy() has cond_resched_lock() to reschedule and drop > > the lock. From your saying, it's spin_is_contended() which is not > > working well to make rescheduling happen during __purge_vmap_area_lazy() > > handling. Then the fixing should be done in lock side. > > Sebastian had sent out patch last year to fix spin_is_contended(). > > https://lore.kernel.org/lkml/20210906143004.2259141-3-bigeasy@linutronix.de/ > > However, there is no follow-up after some discussion and the patch wasn't > merged. That's great. Thanks, Longman. Then this is a good chance to reconsider it, maybe with a test from Zhipeng.