Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5961960ioo; Wed, 1 Jun 2022 17:09:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyApNaQZlWQZ+sqcTpODt0rc4v918ElvT6BxuAiS6XSpBAECZ1InKRaioOrivHHEjJQnnXV X-Received: by 2002:a17:90a:e2c6:b0:1e2:fad9:40f7 with SMTP id fr6-20020a17090ae2c600b001e2fad940f7mr19555671pjb.198.1654128596765; Wed, 01 Jun 2022 17:09:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654128596; cv=none; d=google.com; s=arc-20160816; b=RarQ9gTWOw9LjR9M+oGuGYgAHC5YfY4t9c9CD8hPwXYztrxVPHkQcYPu4YgjKS/DYx ZE4V7DWIkIJng1CwWEvSvZ65QsYQkkOAcr01kmr75JenKvReCFdDP8d9PL2ZTdLbnDuz eNK7dAKFxUfn9Zt90MFsGvbG7dPC1D62zaygb+UtdBRj5eCkCgkjmv0lXGKDhUc10a7w +kL2hOvFLeefgNQl9gwaMhuC4FcU1bv7jfUHcSWBAA+rKnVrwEGrO6lNCal6BQEnixoU PwGqtUQh0uXtB1dnMpQ8WcuHDEdvC44RIqAjtf2TXGkTTXF8nhV3MOXVK5oVpwE1yNq9 rrRg== 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=ae4Em02O4DoW8HqZVWLGSrl5wgz4cCAQSui5vC+qx38=; b=Vos9CxLeS6OQgjVASW07JsLh4eyiSCeCtNNkFKddLtIfwXoNho+SsiMWy8OqZgRihf H8TlELJNNNwzq7/4UpVCY5b2p9b53tmuMryPRRAuhedH7nqix0dg+UsEHy+MQse7s/ox gjJBQRkk49g6FEIDozIgyTRHaaqpXpBEE3UEGadEQfbtSjsLCnOLLeD/gROwQ/JElGLL P0iL3GwWr0AatMmU1vDsmE9N5OFm8OOgBFkuG7AeXKnM804gf9dEvSKYebm/sKeRgTWh gvSFfDnxBI0oYiN6lldjfVHEwebdAxsmOBgw21QbZrrJikd/MkO+bJ19j2GA6g9gtG4Z VXww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SWcH+oIt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f14-20020a63de0e000000b003c6e6ccb295si3926194pgg.624.2022.06.01.17.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 17:09:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SWcH+oIt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 9C3F76C0CF; Wed, 1 Jun 2022 17:07:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232674AbiFBAHU (ORCPT + 99 others); Wed, 1 Jun 2022 20:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232655AbiFBAHS (ORCPT ); Wed, 1 Jun 2022 20:07:18 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4329813D09; Wed, 1 Jun 2022 17:07:17 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 137so3300720pgb.5; Wed, 01 Jun 2022 17:07:17 -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=ae4Em02O4DoW8HqZVWLGSrl5wgz4cCAQSui5vC+qx38=; b=SWcH+oItm/XxdIwRq5d7dWi4k8EsrLve4tmhF9StwgkVAeB/ST+4WCb9E2NxUXGT7g q8GzCidpe0aYC1tY7l8ZUuV3j01269AWUz6gdiLCMvRT1p3tEmlx+qW0snAnBV5OPGvM DXLvnYtjOFtN4WUjBBpXkIykso8QRjUpr72FdUS3296sgzRusW3cir5K4s1OLzUYhfRF Pou3Y74c4/+dj9zMDvz0Zgiu/uUCvVLNWgOZqow7iX/ggarDUwyyXCSl/j1RSV5uOUC2 +1gBSrqQvr/7wPpt4i7OoAuLFKu0wYhBLeQV3POlB/VGAWkw5GU4UB8qeT7IAzJsl6Dq tB4Q== 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=ae4Em02O4DoW8HqZVWLGSrl5wgz4cCAQSui5vC+qx38=; b=g30VzT9eW/lgNgJo4jMIBEr2bX5RLrj3soHu8qOae5Agof0UV1MawfygWBORVI5V0m cNeAkJvkECgNKKwlbrXErmiSOC3me5v4ukUNuw3P80+PRoC8Dhmw6kDanXMK4BCyXDDR /qcPzDtciLX1aQhZ/NaGWplJ+A2+/8Sm7Omm2R6G5vlYzrijaYWLAhzdM1PPdDx4AlLd L1nWU11C5Uu+FBMDCd5y4V854a8D4VpUmKc/ZPUY9do617AEoG1v3GP+YM7ImZDTKwV6 Nuc1ftKvFF8FWPxomnl+1KQDnYHAcdWKfubdsf98pco/oP5lrJ02WFvZJAR0oRpDwVgT Sgfw== X-Gm-Message-State: AOAM5336QkfjBSl1ukf6G5uzy1ryJcybMBQK88bGcFXTNiGFmhutijcm CAdYicc0YxyVixd7JJDcYWw= X-Received: by 2002:a65:6c12:0:b0:3db:8148:308b with SMTP id y18-20020a656c12000000b003db8148308bmr1705470pgu.103.1654128436664; Wed, 01 Jun 2022 17:07:16 -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 u2-20020a17090add4200b001cd8e9ea22asm4339602pjv.52.2022.06.01.17.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 17:07:15 -0700 (PDT) Sender: Tejun Heo Date: Wed, 1 Jun 2022 14:07:14 -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: <20220525151517.8430-1-mkoutny@suse.com> <20220525151517.8430-3-mkoutny@suse.com> <20220525161455.GA16134@blackbody.suse.cz> <0babd7df-bdef-9edc-3682-1144bc0c2d2b@linaro.org> <1fb4d8d7-ccc0-b020-715e-38c2dfd94c23@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Hello, On Wed, Jun 01, 2022 at 05:00:44PM -0700, Tadeusz Struk wrote: > What I'm trying to say is that it's not really a ref imbalance problem. > I think once the kill_css() has been called on a css, and it is enqueued to be > killed, we shouldn't call css_put(css) on it anymore outside of the "killed call > flow path". It will all be handled by the css_killed_ref_fn() function. > > The fact the css_release() is called (via cgroup_kn_unlock()) just after > kill_css() causes the css->destroy_work to be enqueued twice on the same WQ > (cgroup_destroy_wq), just with different function. This results in the > BUG: corrupted list in insert_work issue. I have a hard time following here. The kill / release paths relationship isn't that complicated. The kill path is invoked when the percpu_ref's base ref is killed and holds an extra ref so that it's guaranteed that release can't happen before the kill path is done with the css. When the final put happens - whether that's from the kill path or someone else, which often is the case - the release path triggers. If we have release getting scheduled while the kill path isn't finished, it is a reference counting problem, right? Can you elaborate the exact scenario that you think is happening? Please feel free to omit the function calls and all that. Just lay out who's doing what. Thanks. -- tejun