From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B018318A6DF for ; Tue, 28 Jan 2025 17:07:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738084027; cv=none; b=ZMHkp9HiuQdhs4Ny1AmMO17zOdO33+IeBEHkyo+clpDXAwhSqQpMpU2EMxyJenK9UWMu05XoJkrHmMEu729L2FAE3scfdbBjBTlQMdtJTdjmSpu+U/YHOk5jWpjCmjbcV3IQHjERSHXvZcpRz+gZ/joIcXIvy2bSAEnc1MlyKpk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738084027; c=relaxed/simple; bh=yjbwgdDgUpo90MQR6AL2JaXuNXEK5cuM1WJeDCstHzo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qH8rzQ9p6hQVSjk5mZfrGc7QN+yzXQUJMQ6QV1k4QNNN2ME3dgdkngBopWOfPVpp5kPsw1L0dOu2M1XmWM8FFD7ETq7ymaxFBk0wa7ELJQmI+JKUMfQqkg2BjBgCulnER00YflUivCGqY64R8Q+0ANduNJMAPbtLOP/lrFiCvic= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=IfppcobR; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="IfppcobR" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-216426b0865so98918435ad.0 for ; Tue, 28 Jan 2025 09:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1738084025; x=1738688825; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4aLdluYBQG3NHEUoAm0lTl3WFmZVvtCZOFSLgG2q5V8=; b=IfppcobR9UP8rpvIDlzA6qFFlhE2UMuVwxhu96kyAP5iN1O6cmROgSVWRFOrBT0OMe QjzX3TKJ43ss/IsyViCOGPU6kJ11aCcDqXNMsfOmOdw0hQl8lKZNEV5VJeET7myah4dl izwfDLFbdH152+iEFaXcJq0sOLMQxvePJevWNwuPmveaUl2YWctlicput94oVPmmhJh/ yve89Dh+gIoWY0pcoVRqykBc901nd/oRsWO8AG6JwVY5UHmCQFHD1oLBGooy93hGjKGr AUt53xStO4mJFVvSsq38qrhE2Ua1ANwSNO9o/Jv7B8Xg6J/XKs1coQMEJstsi1AlS0a1 fwPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738084025; x=1738688825; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4aLdluYBQG3NHEUoAm0lTl3WFmZVvtCZOFSLgG2q5V8=; b=JOxRWhVGZ0cTmVwkcDUr29oSSU8Yex0FYbyFo9OgLmFocR1VUiMWjksVUctnKhUhFD L0BNuOVvDohNWEhHQsAAqGHZM2Ttgwf0TdNCdPwgcOWl6lk2InKYaOYIQDzM0B3ys0/j IQhMH9caji2yMp1fQe/Sf07ArEQP1BDUpJAY7kw9HOM5DkedH47XwenCZB1K8CIcL3U+ 3QiBd0TyGejljzBZ1SW3U2b/us14lG0lPFvbsirC0RCl5GbcRbLCQzRaPQITt5larQx3 2Q0/TauuaTnAdVb+lBI+xtuoS6qzm8T+qi+7L85sgBoX2+GzMyr7zpJA1/pjptFrsYkK KKGw== X-Forwarded-Encrypted: i=1; AJvYcCXMOldlomY/etspfsDNwuhKZ7eBYHYldjHXWfjvUmC81Y1VUgDvSTWaw78YMuvp+6kmPRdNvGTUl+vxkXw=@vger.kernel.org X-Gm-Message-State: AOJu0YzLJrkV/OJlJ86rGqKHSyWbYEMw4c63pVMdYnRhPHlESB5jl0yZ aUp4g0TLDsCWBQrK+Ixn3KP7Lm/vB1Ux53CMwmpmaEsh8W9HDJzyotLh0Mbl6i8= X-Gm-Gg: ASbGncuJ4NNTRjtu5ph1g4KLiRHrRg70sSl12CZ3kdzq0vWlTHT2Z7EzqVMKhCa4iyx IZaLBEhw8xnls+mGV18CcHyHiLabWJt9JPutqlXykd1rPMgJ4PcasswGc8SoDliX2Hb2UQT+vNR kWwR4GRWaaQxyZOg6vOcnzydfI7F3Mmriy3AzC+1EKRoGtG4sX2k8f8SyKaiGV29opfLlTpTtiN ZBYBkuF8iH0p/1GFXe47Dy4MrhNPTUA6FtKKhaknhE0dDISfeEC/fTOb91lGxf8pjo2ZjWpGfJl CzgsUzo+9Hczd/f56h8iEoQgK9qVSQapJrkMHYjtEuybW7MAZktIHtgjFwkANIuZlGH24SfFYZX imRb09VEA6RFgd88= X-Google-Smtp-Source: AGHT+IEHJ+yvRm9/dI3EKJujOyu9fMrTbPLV5NN8NzRJ8t2YbBq7WU1UqvWPdbJXbOL6J5IEzRPvgA== X-Received: by 2002:a17:902:ea11:b0:216:3889:6f6f with SMTP id d9443c01a7336-21c353ef827mr617597005ad.17.1738084024877; Tue, 28 Jan 2025 09:07:04 -0800 (PST) Received: from ?IPV6:240e:370:8b13:97f0:154c:a6ff:49c9:f239? ([240e:370:8b13:97f0:154c:a6ff:49c9:f239]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da3faab7csm83853185ad.103.2025.01.28.09.06.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Jan 2025 09:07:04 -0800 (PST) Message-ID: <8b661116-0a85-4928-91ed-3c01ebbf8d39@bytedance.com> Date: Wed, 29 Jan 2025 01:06:55 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [linus:master] [x86] 4817f70c25: stress-ng.mmapaddr.ops_per_sec 63.0% regression Content-Language: en-US To: David Hildenbrand , Peter Zijlstra Cc: kernel test robot , oe-lkp@lists.linux.dev, lkp@intel.com, linux-kernel@vger.kernel.org, Andrew Morton , Dave Hansen , Andy Lutomirski , Catalin Marinas , David Rientjes , Hugh Dickins , Jann Horn , Lorenzo Stoakes , Matthew Wilcox , Mel Gorman , Muchun Song , Peter Xu , Will Deacon , Zach O'Keefe , Dan Carpenter , Rik van Riel References: <202501281734.d408a35b-lkp@intel.com> <46ea4509-0f38-4b22-bd91-f05c68db2562@redhat.com> <20250128113100.GB7145@noisy.programming.kicks-ass.net> <2c599f1f-f63b-4504-a026-46bf73954124@redhat.com> <20250128132847.GB505@noisy.programming.kicks-ass.net> <18172465-37e3-48a9-9d67-0d44fdcb93bd@redhat.com> From: Qi Zheng In-Reply-To: <18172465-37e3-48a9-9d67-0d44fdcb93bd@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 2025/1/28 21:42, David Hildenbrand wrote: > On 28.01.25 14:28, Peter Zijlstra wrote: >> On Tue, Jan 28, 2025 at 12:39:51PM +0100, David Hildenbrand wrote: >>> On 28.01.25 12:31, Peter Zijlstra wrote: >> >>>>> I recall a recent series to select MMU_GATHER_RCU_TABLE_FREE on x86 >>>>> unconditionally (@Peter, @Rik). >>>> >>>> Those changes should not have made it to Linus yet. >>>> >>>> /me updates git and checks... >>>> >>>> nope, nothing changed there ... yet >>> >>> Sorry, I wasn't quite clear. CONFIG_PT_RECLAIM made it upstream, >>> which has >>> "select MMU_GATHER_RCU_TABLE_FREE" in kconfig. >>> >>> So I'm wondering if the degradation we see in this report is due to >>> MMU_GATHER_RCU_TABLE_FREE being selected by CONFIG_PT_RECLAIM, and >>> we'd get >>> the same result (degradation) when unconditionally enabling >>> MMU_GATHER_RCU_TABLE_FREE. >> >> Ah, yes, put a RHEL based config (as is the case here) should already >> have it selected due to PARAVIRT. > > Ah, right. Most distros will just have it enabled either way. > > But that would then mean that MMU_GATHER_RCU_TABLE_FREE is not the cause > for the regression here, and something else is going wrong. > I did reproduce the performance regression using the following test program: stress-ng --timeout 60 --times --verify --metrics --no-rand-seed --mmapaddr 64 The results are as follows: 1) Enable CONFIG_PT_RECLAIM stress-ng: info: [826] dispatching hogs: 64 mmapaddr stress-ng: info: [826] successful run completed in 60.29s (1 min, 0.29 secs) stress-ng: info: [826] stressor bogo ops real time usr time sys time bogo ops/s bogo ops/s stress-ng: info: [826] (secs) (secs) (secs) (real time) (usr+sys time) stress-ng: info: [826] mmapaddr 17233711 60.01 238.47 1128.46 287178.92 12607.60 stress-ng: info: [826] for a 60.29s run time: stress-ng: info: [826] 1447.07s available CPU time stress-ng: info: [826] 238.85s user time ( 16.51%) stress-ng: info: [826] 1128.87s system time ( 78.01%) stress-ng: info: [826] 1367.72s total time ( 94.52%) stress-ng: info: [826] load average: 48.64 20.73 7.82 2) Disable CONFIG_PT_RECLAIM stress-ng: info: [704] dispatching hogs: 64 mmapaddr stress-ng: info: [704] successful run completed in 60.05s (1 min, 0.05 secs) stress-ng: info: [704] stressor bogo ops real time usr time sys time bogo ops/s bogo ops/s stress-ng: info: [704] (secs) (secs) (secs) (real time) (usr+sys time) stress-ng: info: [704] mmapaddr 28440843 60.02 343.93 1090.70 473882.98 19824.51 stress-ng: info: [704] for a 60.05s run time: stress-ng: info: [704] 1441.23s available CPU time stress-ng: info: [704] 344.30s user time ( 23.89%) stress-ng: info: [704] 1091.12s system time ( 75.71%) stress-ng: info: [704] 1435.42s total time ( 99.60%) stress-ng: info: [704] load average: 40.03 11.51 3.96 Then I found that after enabling CONFIG_PT_RECLAIM, there was an additional perf hotspot function: 16.35% [kernel] [k] _raw_spin_unlock_irqrestore 9.09% [kernel] [k] clear_page_rep 6.92% [kernel] [k] do_syscall_64 3.76% [kernel] [k] _raw_spin_lock 3.27% [kernel] [k] __slab_free 2.07% [kernel] [k] rcu_cblist_dequeue 1.94% [kernel] [k] flush_tlb_mm_range 1.87% [kernel] [k] lruvec_stat_mod_folio.part.130 1.79% [kernel] [k] get_page_from_freelist 1.61% [kernel] [k] tlb_remove_table_rcu 1.58% [kernel] [k] kmem_cache_alloc_noprof 1.43% [kernel] [k] mtree_range_walk And its call stack is as follows: bpftrace -e 'k:_raw_spin_unlock_irqrestore {@[kstack,comm]=count();} interval:s:1 {exit();}' @[ _raw_spin_unlock_irqrestore+5 free_one_page+85 rcu_do_batch+424 rcu_core+401 handle_softirqs+204 irq_exit_rcu+208 sysvec_apic_timer_interrupt+113 asm_sysvec_apic_timer_interrupt+26 _raw_spin_unlock_irqrestore+29 get_page_from_freelist+2014 __alloc_frozen_pages_noprof+364 alloc_pages_mpol+123 alloc_pages_noprof+14 get_free_pages_noprof+17 __x64_sys_mincore+141 do_syscall_64+98 entry_SYSCALL_64_after_hwframe+118 , stress-ng-mmapa]: 2283 @[ _raw_spin_unlock_irqrestore+5 get_page_from_freelist+2014 __alloc_frozen_pages_noprof+364 alloc_pages_mpol+123 alloc_pages_noprof+14 pte_alloc_one+30 __pte_alloc+42 do_pte_missing+2499 __handle_mm_fault+1862 handle_mm_fault+195 __get_user_pages+690 populate_vma_page_range+127 __mm_populate+159 vm_mmap_pgoff+329 do_syscall_64+98 entry_SYSCALL_64_after_hwframe+118 , stress-ng-mmapa]: 2443 @[ _raw_spin_unlock_irqrestore+5 get_page_from_freelist+2014 __alloc_frozen_pages_noprof+364 alloc_pages_mpol+123 alloc_pages_noprof+14 get_free_pages_noprof+17 __x64_sys_mincore+141 do_syscall_64+98 entry_SYSCALL_64_after_hwframe+118 , stress-ng-mmapa]: 5184 @[ _raw_spin_unlock_irqrestore+5 free_one_page+85 tlb_remove_table_rcu+140 rcu_do_batch+424 rcu_core+401 handle_softirqs+204 irq_exit_rcu+208 sysvec_apic_timer_interrupt+113 asm_sysvec_apic_timer_interrupt+26 _raw_spin_unlock_irqrestore+29 get_page_from_freelist+2014 __alloc_frozen_pages_noprof+364 alloc_pages_mpol+123 alloc_pages_noprof+14 get_free_pages_noprof+17 __x64_sys_mincore+141 do_syscall_64+98 entry_SYSCALL_64_after_hwframe+118 , stress-ng-mmapa]: 5301 @Error looking up stack id 4294967279 (pid -1): -1 [, stress-ng-mmapa]: 53366 It seems to be related to CONFIG_MMU_GATHER_RCU_TABLE_FREE? I will continue to investigate further. Thanks!