Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp827417ybl; Fri, 9 Aug 2019 14:38:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoGg6hRSgj1IZ82iVILG3MRTm2N80IVWCmEgNij1xpmqmDDNvxh68NIbueadjppaNfoWws X-Received: by 2002:a17:90a:b947:: with SMTP id f7mr4421142pjw.63.1565386700845; Fri, 09 Aug 2019 14:38:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565386700; cv=none; d=google.com; s=arc-20160816; b=XWMTmXF4Z9EqlHuD0mJLxiFxxzYN1x1X22AbYGb83VoyEjY+frYw7pf9r15Q1S73wL 2KCgJOzZfBF76nSacDCkqIL3VdlBr9jjzb5dm4dfNKC6UTbn4pu5A4LEDcYy0UoXJnRy SNvi1D5cIcQ963mYACZC429g2g4vRkgyK7kyH21MupVm+rpuuDC4IPE3FYltDrU7EYGU 6hasqHNbLQYljhwsGUF1Up4F0ccu7W89hs/njqQx2qZYhFVPslIexMKEWhPgE2bWi640 MrPh0Tap/cbpeyKBdt0Xtaep79fTcCVD8q21yVeY4RGGqR/D1z2ZCJlxjnL5Mi5c64BH 0hlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/aPM+dGjqbF/twu7tNDtqtaJN6yd/7yU4c7+a2/cJxw=; b=hy2mirMQRHVpslpfP4nE1RcEHce4+4L6dyUpPhPqXQVyeNZ6gDLXlYha/IeibMY2/j yjryq/8itQ/mPP4uBu+Tfx0FtKXhgrkMNaACJoLlBsyZki/jfkU3qIc+txUux5RQEC6c ltZjDiZgrlHnEZTzgVp97iTW2fXyEuedrekti5YSLS93u8sLxoyISjXQc6jwJbr1q/Qd U9onSj/terog+Xlw+KvRYYSsEdXzinZZRABxTjuVzXsziGMu11V60PlrfNlOQ3TEGFD5 preCR+sJkvuL0VGzohktq1I+QK+qxL4X/3llfgFYJljMSrHfto9/VwZj8VpAd903AaRv SRbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=oLqPhtdY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15si52854652plr.260.2019.08.09.14.38.04; Fri, 09 Aug 2019 14:38:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=oLqPhtdY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727581AbfHIVgr (ORCPT + 99 others); Fri, 9 Aug 2019 17:36:47 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46589 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbfHIVgr (ORCPT ); Fri, 9 Aug 2019 17:36:47 -0400 Received: by mail-pf1-f193.google.com with SMTP id c3so23565492pfa.13 for ; Fri, 09 Aug 2019 14:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/aPM+dGjqbF/twu7tNDtqtaJN6yd/7yU4c7+a2/cJxw=; b=oLqPhtdYAogfpwokAq0y9xZzUtFmKpJVD7GORU7Y4b6sAwR117XaTK37RJPo12PHgG qW5oZhdXQwmz8EjCib2Jicn1UEeY/E3wpbNYGGOsDL2BO+1m+vLZ0446PwAulggiJOUA 0zL4giNtUJtQSiAlNsOGQC2p+AoSkGKRWBVLU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/aPM+dGjqbF/twu7tNDtqtaJN6yd/7yU4c7+a2/cJxw=; b=Bq6Ii5KRMChU8VLbhIz/wvXj9ln5UjC0ZnpWCWgSvEf41pV9nvTjm1haXCmEv1O9uI IDh44HjmZa2ujAzESZc7wSriH0EH71bUszhE5yT+rFNYcSrI0HungzaWGXENODcHT0Eq hRR79q0Wej0Cpl23guNRQ9Y7s45HQXmC0IKWoYLb195cjgVctirdXIE3NAmpdSp/XvS2 Nxx1e41FQR08D6UKDccPdC7fHW51aCGcT6TlfW/YftbvfwBW3MlHkafMUXS3YZniugOy ICQUtabveUqvL8I2ldkGT+WXJM8wyqT84Jic+e4Ktf8Ge6wQ4rpeqGAonOmTT91ML46C ZSCA== X-Gm-Message-State: APjAAAUwGYyYFs/j2UwukJs28HiZgny26mPPLD73sc/nSYMMxFhCMYJ+ +HY55f9h+qE/nHwb0vxtw8gW7w== X-Received: by 2002:a62:3895:: with SMTP id f143mr23417327pfa.116.1565386605846; Fri, 09 Aug 2019 14:36:45 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id a10sm5050392pfl.159.2019.08.09.14.36.44 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 14:36:45 -0700 (PDT) Date: Fri, 9 Aug 2019 17:36:43 -0400 From: Joel Fernandes To: "Paul E. McKenney" Cc: Byungchul Park , linux-kernel@vger.kernel.org, Rao Shoaib , max.byungchul.park@gmail.com, kernel-team@android.com, kernel-team@lge.com, Davidlohr Bueso , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , rcu@vger.kernel.org, Steven Rostedt Subject: Re: [PATCH RFC v1 1/2] rcu/tree: Add basic support for kfree_rcu batching Message-ID: <20190809213643.GG255533@google.com> References: <20190807094504.GB169551@google.com> <20190807175215.GE28441@linux.ibm.com> <20190808095232.GA30401@X58A-UD3R> <20190808125607.GB261256@google.com> <20190808233014.GA184373@google.com> <20190809151619.GD28441@linux.ibm.com> <20190809153924.GB211412@google.com> <20190809163346.GF28441@linux.ibm.com> <20190809202226.GC255533@google.com> <20190809204217.GN28441@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190809204217.GN28441@linux.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 09, 2019 at 01:42:17PM -0700, Paul E. McKenney wrote: > > Also, I can go back to 500M if I just keep KFREE_DRAIN_JIFFIES at HZ/50. So I > > am quite happy about that. I think I can declare that the "let list grow > > indefinitely" design works quite well even with an insanely heavily loaded > > case of every CPU in a 16CPU system with 500M memory, indefinitely doing > > kfree_rcu()in a tight loop with appropriate cond_resched(). And I am like > > thinking - wow how does this stuff even work at such insane scales :-D > > A lot of work by a lot of people over a long period of time. On their > behalf, I thank you for the implied compliment. So once this patch gets > in, perhaps you will have complimented yourself as well. ;-) > > But more work is needed, and will continue to be as new workloads, > compiler optimizations, and hardware appears. And it would be good to > try this on a really big system at some point. Cool! > > > > > o Along with the above boot parameter, use "rcutree.use_softirq=0" > > > > > to cause RCU to use kthreads instead of softirq. (You might well > > > > > find issues in priority setting as well, but might as well find > > > > > them now if so!) > > > > > > > > Doesn't think one actually reduce the priority of the core RCU work? softirq > > > > will always have higher priority than any there. So wouldn't that have the > > > > effect of not reclaiming things fast enough? (Or, in my case not scheduling > > > > the rcu_work which does the reclaim). > > > > > > For low kfree_rcu() loads, yes, it increases overhead due to the need > > > for context switches instead of softirq running at the tail end of an > > > interrupt. But for high kfree_rcu() loads, it gets you realtime priority > > > (in conjunction with "rcutree.kthread_prio=", that is). > > > > I meant for high kfree_rcu() loads, a softirq context executing RCU callback > > is still better from the point of view of the callback running because the > > softirq will run above all else (higher than the highest priority task) so > > use_softirq=0 would be a down grade from that perspective if something higher > > than rcutree.kthread_prio is running on the CPU. So unless kthread_prio is > > set to the highest prio, then softirq running would work better. Did I miss > > something? > > Under heavy load, softirq stops running at the tail end of interrupts and > is instead run within the context of a per-CPU ksoftirqd kthread. At normal > SCHED_OTHER priority. Ah, yes. Agreed! > > > > > o With any of the above, invoke rcu_momentary_dyntick_idle() along > > > > > with cond_resched() in your kfree_rcu() loop. This simulates > > > > > a trip to userspace for nohz_full CPUs, so if this helps for > > > > > non-nohz_full CPUs, adjustments to the kernel might be called for. > > > > I did not try this yet. But I am thinking why would this help in nohz_idle > > case? In nohz_idle we already have the tick active when CPU is idle. I guess > > it is because there may be a long time that elapses before > > rcu_data.rcu_need_heavy_qs == true ? > > Under your heavy rcuperf load, none of the CPUs would ever be idle. Nor > would they every be in nohz_full userspace context, either. Sorry I made a typo, I meant 'tick active when CPU is non-idle for NOHZ_IDLE systems' above. > In contrast, a heavy duty userspace-driven workload would transition to > and from userspace for each kfree_rcu(), and that would increment the > dyntick-idle count on each transition to and from userspace. Adding the > rcu_momentary_dyntick_idle() emulates a pair of such transitions. But even if we're in kernel mode and not transitioning, I thought the FQS loop (rcu_implicit_dynticks_qs() function) would set need_heavy_qs to true at 2 * jiffies_to_sched_qs. Hmm, I forgot that jiffies_to_sched_qs can be quite large I guess. You're right, we could call rcu_momentary_dyntick_idle() in advance before waiting for FQS loop to do the setting of need_heavy_qs. Or, am I missing something with the rcu_momentary_dyntick_idle() point you made? thanks, - Joel > > Thanx, Paul > > > > > Ok, will try it. > > > > > > > > Save these bullet points for future reference! ;-) thanks, > > > > > > I guess this is helping me to prepare for Plumbers. ;-) > > > > :-) > > > > thanks, Paul! > > > > - Joel > > >