Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5973559ioo; Wed, 1 Jun 2022 17:30:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw//NIuaYTAxRaKvkFZeU9KJNd3KJYogcf2/NnyEUCk/UKgowUpMQ+0xoGRv69j7aPrTNvt X-Received: by 2002:a17:902:ec88:b0:166:33fe:a60c with SMTP id x8-20020a170902ec8800b0016633fea60cmr2012577plg.157.1654129802908; Wed, 01 Jun 2022 17:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654129802; cv=none; d=google.com; s=arc-20160816; b=x2QI4ZAYAa7LejZ1uimueE1rOetfDQgUYrL/s2cxUw4DvRp5TCqAsCD/8FWoYtJaxu 9huEPIRsT7020SMdtBOu151shuwwGdkwnU50wKmFTZQpHM4YYw+seAss//PrcKfbi4iu Aodq5hC9ssnI99s9gWgbSIt0ylmcXsbLVBeTIvjvmdi8BkrF9opxyZIQSbtXZEsEi4kX yXrwhUU/1FVpGSgIdZRMoXk2xzs76Ph4M6Xw6DIN5zCfG8I67HL57zkFkHTsoi1XlNx7 F8PlTqfms9KI4qLlRD+dcq2fyKLp56OFmLGXoKTJ+rm9odIOUnssqq0DsAvsJAB8+QWG TdTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=cd8OZfkfOfbdrVH9nYcg5+3JeiqoxxNBfwL2one6FPI=; b=H/wuZllwHxtRT/ohP7YO8QU1zOzxZ215kAF4mH5taFegFcd+DgWTX4q8qN9Urhml5o do+jmXCoyjlzwlv/1iWhcISY1KBtBaqONS2ffyt1yws4yZUNsGcGzEE7DnQ2PPCPMIi9 5rDf9097kP8j0rzKBBo2K5KdT/mFzG317oRWcuVqChlPuEDzxoH4LaT2ZOmbAoBbngZk LBrcxmqUm6Z7Q2NX4u2B4mEn9KdG2GTI+Ds+WX2yq1Aj2R1D/TTiAUITX+Ix5dHn/vWc eDRXWMPteFwThEcP7lzZRjs++3HNsihwEt/0nG0VZXtIiVPRCe0+BbDeqGHhOa6cCrPt Ircg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jnHM3OC9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a64-20020a639043000000b003fcb8abc153si2628492pge.587.2022.06.01.17.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 17:30:02 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jnHM3OC9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6885CDE304; Wed, 1 Jun 2022 17:29:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232735AbiFBA33 (ORCPT + 99 others); Wed, 1 Jun 2022 20:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232734AbiFBA32 (ORCPT ); Wed, 1 Jun 2022 20:29:28 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D513B29B11E; Wed, 1 Jun 2022 17:29:25 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id q18so3158173pln.12; Wed, 01 Jun 2022 17:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cd8OZfkfOfbdrVH9nYcg5+3JeiqoxxNBfwL2one6FPI=; b=jnHM3OC9fRgEf/1zuyaXHSXBeile/rBcpDVd8BJSs0VVnbhYPwNj+cWPNmgQAmvHeW 4iGEMcxNC+qiLljZ8z8i9CJvG5r8NHZhqNXaUcIrZ84DpP51x+Ahhebso1nAqKjD/OTn b3uitEK1RVAtJ8oXA9Mjm5zS61EZ7uHPRLfDDeqOHSPjRwvoj63mJd51XZRJLAvEmGp3 QSj1724wDBVcxczmWh5BVAFAZcgYw0QupcnmzOa25Oyrii6AtIl4Dq+nhwGTL0fpfSrs xtjKtGmnYxhc18OuN0W283tCI7OwaZS3UwG99PfIVIXxD7PzY/+AGupJgN9a9Ho1ypod yPNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=cd8OZfkfOfbdrVH9nYcg5+3JeiqoxxNBfwL2one6FPI=; b=HCGiy9wHg4VMyXIcjSNEEG/daYDFH+rQkWbPk7n+9yxV14loctjutMmiFBMnAwhAdG LUQxOsgmrxD3u7DDGQuwC1q5V5X62crrhs7x95tEwrTxmc2q9BwVF8tlojEIkAyqI2Pz uPDP9JeNJgVtoJ8MmNE3k1rW5b5dLVbidNw59Ns7IEZ17Gy32PbXcrtb0mYgZBPJRUiw bWCI5E2ik590wl7CRIvTDTRl85Vc/QNTsFgUR03Ae7yUTNtJeYd3pUiX7iAS2i7DjrPL mNCWmVd8vUBINAkE2C6fvKcja06/fpQkRVkFNrvfcddlS2jCdGZ7qWZJKEXSC2Vakb9l VqiQ== X-Gm-Message-State: AOAM530QQLt/4YQ1ajmhC+5UJCsShq9c2CBZUF5InBqHRdD0p91d/JQx ik1GPLbJlBXkcjKRNgQw1lndbE/l4HE= X-Received: by 2002:a17:902:d4c1:b0:162:dd2:407 with SMTP id o1-20020a170902d4c100b001620dd20407mr2036142plg.15.1654129765268; Wed, 01 Jun 2022 17:29:25 -0700 (PDT) Received: from localhost (2603-800c-1a02-1bae-a7fa-157f-969a-4cde.res6.spectrum.com. [2603:800c:1a02:1bae:a7fa:157f:969a:4cde]) by smtp.gmail.com with ESMTPSA id p8-20020aa78608000000b0051b9d27091bsm2029418pfn.76.2022.06.01.17.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 17:29:24 -0700 (PDT) Sender: Tejun Heo Date: Wed, 1 Jun 2022 14:29:23 -1000 From: Tejun Heo To: Tadeusz Struk Cc: Michal =?iso-8859-1?Q?Koutn=FD?= , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Zefan Li , Johannes Weiner , Bui Quang Minh Subject: Re: [PATCH 2/2] cgroup: Use separate work structs on css release path Message-ID: References: <20220525161455.GA16134@blackbody.suse.cz> <0babd7df-bdef-9edc-3682-1144bc0c2d2b@linaro.org> <1fb4d8d7-ccc0-b020-715e-38c2dfd94c23@linaro.org> <416dc60a-f0e5-7d05-1613-3cd0ca415768@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <416dc60a-f0e5-7d05-1613-3cd0ca415768@linaro.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 01, 2022 at 05:26:34PM -0700, Tadeusz Struk wrote: > Ok the problem is that > > 1. kill_css() triggers css_killed_ref_fn(), which enqueues &css->destroy_work on cgroup_destroy_wq > 2. Last put_css() calls css_release(), which enqueues &css->destroy_work on cgroup_destroy_wq > > We have two instances of the same work struct enqueued on the same WQ (cgroup_destroy_wq), > which causes "BUG: corrupted list in insert_work" #2 shouldn't be happening before kill_ref_fn() is done with the css. If what you're saying is happening, what's broken is the fact that the refcnt is reaching 0 prematurely. > So I think the easiest way to solve this would be to have two separate work_structs, > one for the killed_ref path and css_release path as in: If you do that, you'd just be racing the free path against the kill path and the css might get freed while the kill path is still accessing it. Thanks. -- tejun