Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2569020lqz; Wed, 3 Apr 2024 01:50:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXqMyeG5WyM0xjpd/wEdPFz7ixHLQHwURpTxhQcgB+YrT+igTONTO+tXmJ2RTfd4j0/7tp4iizcHylS6qLd+8ju+PqSfsEI5J3OPaCdbA== X-Google-Smtp-Source: AGHT+IE/vpxO7rspdf4mxyw40gBJ82cy80BWczwHhg8jpDCCYr/YjTltTwpFRQZ5YvmzuQ+gngEX X-Received: by 2002:a05:622a:1486:b0:431:6303:2949 with SMTP id t6-20020a05622a148600b0043163032949mr3168918qtx.22.1712134242436; Wed, 03 Apr 2024 01:50:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712134242; cv=pass; d=google.com; s=arc-20160816; b=zh50kXWYJDWQQcNVuyI8Itz5jrqoMt9P7hP4nxeMmxKZjV/rPrIZwmAfDBmb+tZe0q LD/eSieP1CtrBqjEFoM9SLrU/DXluUEEuHjMKjdlLrWXrfV6UGgdwTwUzzNPYMB+gJsE nmLmDiweB4D0ldWrY9aoY0RZkUnK+IiH1+ZHTjDGA4bAlDbqZStnTr55qWKk2E94SAMx AwGYrWqTBhoThAs7jv6tgFPYDA11w3+LafmHISvnBohde62C8TqMJrlX5bipR1q0GjC1 qT1DrtN7prHZ5pgadaJ4bto0UiALkeT+IPMmHcXnx+6OOSDIiOxJbFAzrpW7cMi+Hu3E 6U2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=tDYrzVb79hRkf4FLDOVlAJNZGqG/VdgpR+M9+z2+ZP4=; fh=vIB8YdJ6bIn1eeNirvISNI8zXGfGcAXYwy7zRX7aYq8=; b=f7kZLsUReT5XFOdUp0STSZCY/2dFQIu/yxgc6x46izcGzqyW0YF/KD/0518JH6y0cJ +abftiMIlpJmhhyQ1MjEZcfl/YWDQgK5kjWIKrKLgy0eFgQYqXfFDjLDy1hbuvkPxn7n qEM+HRDw7rO9V59i4J3ZdPA9S7f1w/CmcorYtlFTGkuaayS6ej6l2/cKJQEYxZGHxygD wwmGtOiQmo3LYywOM1DT33G1qSE1WnMUuEOx13MeUBP4X4iEgCNbwsArwxcuHHsAektf oCWL63RNqPoMtABmd4pnX6JmIQovAsjPWVpEvnOGU4ShnHcY5KbmTp9bGp/s6flo5Rey gT4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-129366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129366-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d13-20020ac85acd000000b0043433eac4a8si3402433qtd.515.2024.04.03.01.50.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 01:50:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-129366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129366-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2D08A1C25EFA for ; Wed, 3 Apr 2024 08:50:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 980F47172B; Wed, 3 Apr 2024 08:50:23 +0000 (UTC) Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 875ED70CA6; Wed, 3 Apr 2024 08:50:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712134223; cv=none; b=EZ06PO96aGnHXvo2qMhoDfXe+4H2FohlQMTUaFSPHTc3tRsN/X3gEfA0kTGqGfFMZXSKEU2T4Uf42/NiIhB5Bw9ks1eQnJR1T+hVSp1T2lYnlsXQMJxUVi/lImTCT8wFM3ElbRzG3GjxmOP8GfuC/Haqkb9d96LedwumjzH65xc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712134223; c=relaxed/simple; bh=j6PVjnhEwFnTM08n6aItl3eHzcT4fMKyQysaXwS7MUI=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=EfnsrhFeVLr2ou5PRHIPD2TDrgOzt4+30LJDk3PPqaYDQLFrKS5VnYiL0uSGhZub/AW1P8+NPJKhZ/7OJMmZIwXotUIfFlxnGKLLzJ+bGLZWP9H2jP7vBLA8c/fy549/RvoTp5SvuGzV6hIWg4eWVBQpPkhxTJMcTqM47knuYFk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4V8djt1bSHz4f3kny; Wed, 3 Apr 2024 16:50:10 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id B82B31A0568; Wed, 3 Apr 2024 16:50:16 +0800 (CST) Received: from [10.174.178.129] (unknown [10.174.178.129]) by APP1 (Coremail) with SMTP id cCh0CgD3Ew1HGA1mt0KtIw--.56654S2; Wed, 03 Apr 2024 16:50:16 +0800 (CST) Subject: Re: [PATCH 6/6] writeback: remove unneeded GDTC_INIT_NO_WB To: Jan Kara Cc: Tejun Heo , akpm@linux-foundation.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, willy@infradead.org, bfoster@redhat.com, dsterba@suse.com, mjguzik@gmail.com, dhowells@redhat.com, peterz@infradead.org References: <20240320110222.6564-1-shikemeng@huaweicloud.com> <20240320110222.6564-7-shikemeng@huaweicloud.com> <20240327093309.ejuzjus2zcixb4qt@quack3> <20240402135306.kluke2jjcmh5f4ei@quack3> From: Kemeng Shi Message-ID: <50663bca-3851-42bb-ef1d-5fee8fc7b9b6@huaweicloud.com> Date: Wed, 3 Apr 2024 16:50:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240402135306.kluke2jjcmh5f4ei@quack3> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit X-CM-TRANSID:cCh0CgD3Ew1HGA1mt0KtIw--.56654S2 X-Coremail-Antispam: 1UD129KBjvJXoWxAw47Zw13Cw4fAw18Cr45KFg_yoW5ZFWfpF W3Xa1DKay5Ja4SqrnIgwn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ote: >> on 3/27/2024 5:33 PM, Jan Kara wrote: >>> On Thu 21-03-24 15:12:21, Kemeng Shi wrote: >>>> >>>> >>>> on 3/20/2024 11:15 PM, Tejun Heo wrote: >>>>> Hello, >>>>> >>>>> On Wed, Mar 20, 2024 at 07:02:22PM +0800, Kemeng Shi wrote: >>>>>> We never use gdtc->dom set with GDTC_INIT_NO_WB, just remove unneeded >>>>>> GDTC_INIT_NO_WB >>>>>> >>>>>> Signed-off-by: Kemeng Shi >>>>> ... >>>>>> void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty) >>>>>> { >>>>>> - struct dirty_throttle_control gdtc = { GDTC_INIT_NO_WB }; >>>>>> + struct dirty_throttle_control gdtc = { }; >>>>> >>>>> Even if it's currently not referenced, wouldn't it still be better to always >>>>> guarantee that a dtc's dom is always initialized? I'm not sure what we get >>>>> by removing this. >>>> As we explicitly use GDTC_INIT_NO_WB to set global_wb_domain before >>>> calculating dirty limit with domain_dirty_limits, I intuitively think the >>>> dirty limit calculation in domain_dirty_limits is related to >>>> global_wb_domain when CONFIG_WRITEBACK_CGROUP is enabled while the truth >>>> is not. So this is a little confusing to me. >>> >> Hi Jan, >>> I'm not sure I understand your confusion. domain_dirty_limits() calculates >>> the dirty limit (and background dirty limit) for the dirty_throttle_control >>> passed in. If you pass dtc initialized with GDTC_INIT[_NO_WB], it will >>> compute global dirty limits. If the dtc passed in is initialized with >>> MDTC_INIT() it will compute cgroup specific dirty limits. >> No doubt about this. >>> >>> Now because domain_dirty_limits() does not scale the limits based on each >>> device throughput - that is done only later in __wb_calc_thresh() to avoid> relatively expensive computations when we don't need them - and also >>> because the effective dirty limit (dtc->dom->dirty_limit) is not updated by >>> domain_dirty_limits(), domain_dirty_limits() does not need dtc->dom at all. >> Acutally, here is the thing confusing me. For wb_calc_thresh, we always pass >> dtc initialized with a wb (GDTC_INIT(wb) or MDTC_INIT(wb,..). The dtc >> initialized with _NO_WB is only passed to domain_dirty_limits. However, The >> dom initialized by _NO_WB for domain_dirty_limits is not needed at all. >>> But that is a technical detail of implementation and I don't want this >>> technical detail to be relied on by even more code. >> Yes, I agree with this. So I wonder if it's acceptable to simply define >> GDTC_INIT_NO_WB to empty for now instead of remove defination of >> GDTC_INIT_NO_WB. When implementation of domain_dirty_limits() or any >> other low level function in future using GDTC_INIT(_NO_WB) changes to >> need dtc->domain, we re-define GDTC_INIT_NO_WB to proper value. >> As this only looks confusing to me. I will drop this one in next version >> if you still prefer to keep definatino of GDTC_INIT_NO_WB in the old way. > > Yeah, please keep the code as is for now. I agree this needs some cleanups > but what you suggest is IMHO not an improvement. Sure, will drop this in next version. Thanks, Kemeng > > Honza >