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 B98E7C28D13 for ; Thu, 25 Aug 2022 05:15:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11D926B0074; Thu, 25 Aug 2022 01:15:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CC5A6B0075; Thu, 25 Aug 2022 01:15:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED6C7940007; Thu, 25 Aug 2022 01:15:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id DE4446B0074 for ; Thu, 25 Aug 2022 01:15:14 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A73B41409C0 for ; Thu, 25 Aug 2022 05:15:14 +0000 (UTC) X-FDA: 79836951348.13.6030907 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by imf01.hostedemail.com (Postfix) with ESMTP id 4663E40002 for ; Thu, 25 Aug 2022 05:15:14 +0000 (UTC) Received: by mail-pg1-f180.google.com with SMTP id f4so15075517pgc.12 for ; Wed, 24 Aug 2022 22:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=IoTGWLwyvop2rVJHP5oZfbgjn5SZOhi7mBp2mLs3b8o=; b=hWS35hzvkklbPcmzwr0ke1xSxxNLIZKEBgu4EdC6aCEgE6xHVkCoEu2kno5YJ6tfXm 8kVoPTREEk7eK5hr/lSMQHfXsHXXJrTryQ5SQuOYIMm1SxLSGqxQaj5cxlwMFR7NVMUA J+9VxSCRchN1w/+Nl0TqCDp8XsDn+ieiGDZemsR78I7kLEd9Xv2+/uwr1JUvdqDJcOIW dheI0IvamqlSUVySz9mq5CJM7QA+N+r8QkOHViKrdXOyfS/FAD3OND17l86YOmln2Mgb uxVlZ27HeQ1GGSTVTUs/pWpqZRyfZMdKCr0ejgTmPmh5aOWXZR92En4revU68HT6uMt2 pgWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=IoTGWLwyvop2rVJHP5oZfbgjn5SZOhi7mBp2mLs3b8o=; b=iQI7SvVGF4XuYUE5Tn+IzODTztbzRtfcOwiMciyUSqz9xo/HKPqBVnTITdEhqEM6/l /80zjaF+k/xHAnq3OkGENV6O21Qn9yL1oUI24bGHO+T1BbJmABzEaedCvyVLTG3rmMpb yEsp/xnEGZQHX7iXlKWpdyzWkqusfTPi54ZY1raQpIcPAHHcpJAZgt/1+Wd8U8XT0LaH VgYynGX48LxcSeHQpTkFuEaAVYMU6C+mRPSu/ggdQ1cw0vsJGIKTqUyTDeiblkO2sFXE 5G+gkyB46mH1DRXS7pIcsj+iVNC/VnSE3kwQjL0IjrpZmTXqjhjNz8Xj+EVRPE5dy94i HAMQ== X-Gm-Message-State: ACgBeo3CYz9zB/81+eX54GPILu77ele8+aIxnXrryRkw2ZxMNHmGwA92 erwJOK0fnxXNP29hA/14btg= X-Google-Smtp-Source: AA6agR4r1V9IbnMNeexhhTPrl4XJ3D41ExWsIOPUH4wsZ2kpePU5MZBWLgwlH6ZGFjXh5lysPMXwLQ== X-Received: by 2002:a05:6a00:4393:b0:52f:3603:e62f with SMTP id bt19-20020a056a00439300b0052f3603e62fmr2492716pfb.23.1661404513144; Wed, 24 Aug 2022 22:15:13 -0700 (PDT) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id h20-20020aa796d4000000b0053671a241a5sm8763912pfq.191.2022.08.24.22.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 22:15:12 -0700 (PDT) Date: Thu, 25 Aug 2022 14:15:06 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Christoph Lameter Cc: Vlastimil Babka , Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, Thomas Gleixner , Peter Zijlstra , Steven Rostedt , Linus Torvalds , Matthew Wilcox , Andrew Morton , David Rientjes , Joonsoo Kim , Pekka Enberg , linux-mm@kvack.org Subject: Re: [PATCH 1/9] slub: Make PREEMPT_RT support less convoluted Message-ID: References: <20220817162703.728679-1-bigeasy@linutronix.de> <20220817162703.728679-2-bigeasy@linutronix.de> <5679405a-b3c3-6dc5-783f-7ebeda7c9bf0@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661404514; a=rsa-sha256; cv=none; b=NpEwyitRP4hFU/X5gOFxcvsvIcg4lB19oOAWQuF7LAQaK4AXYD1zJORkwECmcv39hUOhXl 91cn+tZLWrvA2+nlVWHYdBsIWEDE5sXnybsmhQgk9lv4o1IJ03cHc2Tn32zNlmJ6lqPLiV knzXhJA15CizBTPGbL9zOsjdnu6gsp8= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=hWS35hzv; spf=pass (imf01.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.180 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661404514; 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=IoTGWLwyvop2rVJHP5oZfbgjn5SZOhi7mBp2mLs3b8o=; b=0KaUo7jLb6Ln2p+XimITNp/voikXrAnk8KYZ2D/2GuoUHJ6BuOUW3RNfjVLgjYBEnMjo1B J6y0UrsLpNTMA3TCEHizGVFljkQPMnfaTDm1oHSDiVRnWJP6lrqOGIuO+bPXRO/NhSdIY6 +0jfv8tMLp0GdHJui+OnhlihGut0fVE= Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=hWS35hzv; spf=pass (imf01.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.180 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: axdxtj1ij5f7at17e7p5j95myepedpdf X-Rspamd-Queue-Id: 4663E40002 X-HE-Tag: 1661404514-734556 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 Fri, Aug 19, 2022 at 05:04:31PM +0200, Christoph Lameter wrote: > On Thu, 18 Aug 2022, Vlastimil Babka wrote: > > > On 8/18/22 11:42, Christoph Lameter wrote: > > > On Wed, 17 Aug 2022, Sebastian Andrzej Siewior wrote: > > > > > >> + * On PREEMPT_RT, the local lock neither disables interrupts nor preemption > > >> + * which means the lockless fastpath cannot be used as it might interfere with > > >> + * an in-progress slow path operations. In this case the local lock is always > > >> + * taken but it still utilizes the freelist for the common operations. > > > > > > The slub fastpath does not interfere with slow path operations and the > > > > That's true on !PREEMPT_RT because a slowpath operation under > > local_lock_irqsave() will disable interrupts, so there can't be a > > fastpath operation in an interrupt handler appearing in the middle of a > > slowpath operation. > > > > On PREEMPT_RT local_lock_irqsave() doesn't actually disable interrupts, > > so that can happen. IIRC we learned that the hard way when Mike > > Galbraith was testing early versions of my PREEMPT_RT changes for SLUB. > > Well yes if you enable interrupts during the slowpath then interrupts may > use the fastpath. That is a basic design change to the way concurrency is > handled in the allocators. > > There needs to be some fix here to restore the exclusion of the fastpath > during slow path processing. This could be > > A) Exclude the fastpath during slowpath operations > > This can be accomplished by setting things up like in the debug mode > that also excludes the fastpath. I think we can do that by disabling preemption (for a short period, I think) in slowpath on RT (like disabling irq in non-RT) But I wonder if RT guys will prefer that? > B) Force interrupt allocations to the slowpath. > > Check some flag that indicates an interrupt allocation is occurring and > then bypass the fastpath. There is nothing special about interrupt allocation on RT. All users of SLUB on RT must not be in hardirq context. So I don't think it is possible to distingush between a thread being preempted and another thread that preempts it. -- Thanks, Hyeonggon