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 8920CCD1284 for ; Tue, 2 Apr 2024 13:53:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 119D06B0085; Tue, 2 Apr 2024 09:53:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A3606B008C; Tue, 2 Apr 2024 09:53:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E858B6B009C; Tue, 2 Apr 2024 09:53:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id CB7CD6B0085 for ; Tue, 2 Apr 2024 09:53:21 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 89369C0890 for ; Tue, 2 Apr 2024 13:53:21 +0000 (UTC) X-FDA: 81964733802.14.E39EFF2 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf12.hostedemail.com (Postfix) with ESMTP id E020140013 for ; Tue, 2 Apr 2024 13:53:16 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=GYOArCvz; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=oVQiqqsS; dmarc=none; spf=pass (imf12.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712065997; 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=FGcfQklvUedGwDv0N6DFd1u+IVz+5qx/4hMKzVEGwI8=; b=IU1alyYeWObYtt9o5ZbOvVJHMhHEaVGY0z3MngOMTQse/EHkba6pIyvQSFKzL5DD8fujoj 21vR7sHRDT7a4mUse7zo1T6cV6UVe9HW/7OepQ++Bc8amLvu/iuMgLAHJ6YAXeJcQSyXVn 5x6ejwxkJqqBAWxuuFWSSpSsGzsUuoU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=GYOArCvz; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=oVQiqqsS; dmarc=none; spf=pass (imf12.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712065997; a=rsa-sha256; cv=none; b=pL8Alrewgi+Ejsa1l9yiZl7UAs2T6SatvaDkSSw5NTXv58xE8fArw5BhrBg9ARJWdwdS+M 5XT2amCxWPV0YaLBBcpDcmynIq7QqH1J4buzJtpum0nXznTYf6+M9eJ58KBCJpUqN/JAYN KY1wYHilFLqitIn386RKL0vzcbKQc5M= Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0E8905BDF2; Tue, 2 Apr 2024 13:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712065995; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FGcfQklvUedGwDv0N6DFd1u+IVz+5qx/4hMKzVEGwI8=; b=GYOArCvzuT6FP3IcfS3UQE4mfVipbv0+wGzv1Ht12S5KDzRcG57i9bzNKECetfosW/EZDK FRdJRkOOFBB6VFLVFHPeAmoIGmsgiAIgaPsCi6V5QKWP4TNnUjjPWb3YXBWnSwqC/9dxvV hDYNPljnvTDAxZHNHxUmWJ69XJi7Hkk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712065995; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FGcfQklvUedGwDv0N6DFd1u+IVz+5qx/4hMKzVEGwI8=; b=oVQiqqsSkWTMu+wnMPetAL7KPG+bdsPQACuZiBPlnhEX6ceCgZlAPkxLH3PTMYeoCTe+EP ymdF70jwspkycOCg== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id F0AD913A90; Tue, 2 Apr 2024 13:53:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap2.dmz-prg2.suse.org with ESMTPSA id mM66OsoNDGYaXQAAn2gu4w (envelope-from ); Tue, 02 Apr 2024 13:53:14 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 92DB2A0813; Tue, 2 Apr 2024 15:53:06 +0200 (CEST) Date: Tue, 2 Apr 2024 15:53:06 +0200 From: Jan Kara To: Kemeng Shi Cc: Jan Kara , 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 Subject: Re: [PATCH 6/6] writeback: remove unneeded GDTC_INIT_NO_WB Message-ID: <20240402135306.kluke2jjcmh5f4ei@quack3> References: <20240320110222.6564-1-shikemeng@huaweicloud.com> <20240320110222.6564-7-shikemeng@huaweicloud.com> <20240327093309.ejuzjus2zcixb4qt@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: E020140013 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ursfx6h6duwhqg98txhia8m6kdo4jxrb X-HE-Tag: 1712065996-813013 X-HE-Meta: U2FsdGVkX18NQyFiYuyIUrHidnLPtoygdFBO4yCVgJV6QHHRe+OeJhOD/yLlS0zthCuGe7hpBcEJhyKcnamroGqAXJswvfXnVcNp3o0Wa+qXa8pS45totw0WcIhbke3N7L/xKBjsoSbf5g93Oo+EIxU6U6IKoXomWxA0N8mLmJZc+qSPuf2n+1jyWKr1j4qEjcUoqqFla3kJCLDvkggTaZwTicKXvEMu5CEw0vsE0QAO1BHdRe099jMaNw1Hs91nQuuXpwh1Ng0qIbB1iRF1kMAqLGC3ayL5I6CU6jVtiBFU6HrKPWW/v0XJ1T+B3/1bX5LF9EWrC/ziEOBysNAe7Dl4QmSuAGvPRHBDWJpAq/1H/dN62eThK/pnipGo3zKOu46qexwXcaepevctVikQlTE0HPAfo0Nh3rw4nfUuu2fQXapMKutlW8ZDW0aKPQHM6RPSm0fVqBGgdEU7sZKKJXg5BiIsjN4DdYKsz+zGSMWG/vR78ELgY/7EwiQd2mFTPr94hJaBZIfv3rYbxJLSh6qk5pnX7KZBVjMBBpchEn8yf+CP0DLYZeIyg1iNCoqwRl0jDwri9b6j/FgYSdS5nEdnpG0OLaxNStcTOse33l/GVuecg/zQRzfYB9taVT/IV0hIB5eSiCIO4NJH4DQbwMz7acfkAHvD3nDyBrrR1aiOR7US/wLcT6WgqILi3A7ToCczKmfzPU0mfmB7ocaoORiJC9KfgUMyumP6TNPbC92Enr7Y2qdEGlgM4N7h9AGh9FGkrtcgL1TcvrdEVtnNNg1J1vp0Mro06Rzjb/+/YPLBVAGC5dP03e6Q7ULoI1GcHS7Tl2vY1HyiJ/C+5es0HXJANRr7i8egdDv3oNke1Ivd7StjGaWEmUvkudo8R7mIR1iuKWJiBzpIcbNZQUUkhfi2boHv02btLSJlb/GWDo66c+TnK35rwmEyTOHsbUsZPa0trfqr8KE+dJHm88m O8XsONE7 SioODRKcf1MB9DLv2gyRdpndKwaidBzxoh+TNSsHhVa+MR1k8zh/3/KlFdhP9q6h3yhtoh1KtnrVx/pvtLLk9TLGd7eh1kOviJb0lpc9WK4zni1rpVIF1YqlmYt+IEijHAXtvuq7K17SkGpjKdu1rONeHZXxaeE20/YdDYY5YyB5WjmKIaG5AtLc7Pgnec32gRw90Wffvx4vTdws60yKHTBOB5O2feaEb1Tuco+HTabWDRlHeb4Va3QLV3d9J6c9IBOGksKYLcxySw5nf8oNBZ/iRD/H3QnQsasoow5S3bERyAv79I7kVz7Uxq06DqhUHHs8OvdZLz1d8v3F/BQ/7i2YmxCcoG5Up8KK8Fz170NTL1GdtBk2vBJurz8I4qP9H37syDIty8Oe7NfY= 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: List-Subscribe: List-Unsubscribe: On Thu 28-03-24 09:49:59, Kemeng Shi wrote: > 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. Honza -- Jan Kara SUSE Labs, CR