Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1074514rdb; Fri, 19 Jan 2024 07:27:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHyyatx0i1BMpWRwGKkMUQ4777aR8RyjMpVDqxxJxhqTFmAc40F5XuAaJYSCk8N1KZcIBb X-Received: by 2002:a17:90a:eb8a:b0:28c:4a67:eb7d with SMTP id o10-20020a17090aeb8a00b0028c4a67eb7dmr1917818pjy.48.1705678074435; Fri, 19 Jan 2024 07:27:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705678074; cv=pass; d=google.com; s=arc-20160816; b=mzM8MPyuqfxb+XoyQjbrV2fMVVZwop2qjGPMHqlW5O/XXZsncZNGAG4MZJ2uVlvBpi yh8atYtX1bhVFAcoSZdZUC5FAyshUdIopJv6CgHHvKdyCjL/lLjWjXz7aXg0SPq4vhL+ m5vWwMdPfeaMCqRM+oGtOu4szl3LU4EsJ7Y8TO2p7gf7o2VWUn4RidFffQzW0CMVZEYr HZOIZchCRVydTMgD0VPkLD31//DGAbgx6hfW0xIHna+DrBWvztl7jLEKSWlre4HBrO5I 9esTbwocrw7jB5RFH7+K0IN1v8ijzoGrcV5B0gSmRhTAgjJ4Tbf1GCrDZhn/PMn0tUvW 3alA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; fh=acBhmxfNuaEgcz/aphdZtLHGfYja4uW9rmft64qAqJY=; b=WSi/lZIsK7fLWhIlGk8Rdm/7NKhR6JM2a5dj3O2lK9D1DYTdcrZJU9XxtD2wbeZcPK vbLUo6UNKDlOsJ6cAQ6gVZdHSkWZdAkSJcQ5TAgVantRJthM+16vsz2ASHehMI+stdsT 1PpK+20DO5xaNBkXACVm6BZeIOY7+G+l4/8CBNAeKvMs1mHqg4xFMoWfhLVgW53b2xkk 3HxyQbcwtBPXlm7mBnJDuRjQyIuVihujOcR6Bme+XJ2OQ/D11g6L2WjzWqAOMaaxFoBF mafRwpwyH5KdzsngrWHeCgL0VAmOrqbDlc7xw00Eg2HDatKeOBjxYignTvLb/BI5tgap E71g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=nWM6ElDs; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=nWM6ElDs; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=dNXizWJn; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-31315-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31315-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w4-20020a17090ac98400b0028e67f23698si3456250pjt.90.2024.01.19.07.27.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 07:27:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31315-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=nWM6ElDs; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=nWM6ElDs; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=dNXizWJn; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-31315-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31315-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 60F9E288C52 for ; Fri, 19 Jan 2024 15:27:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 213D154BCF; Fri, 19 Jan 2024 15:27:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="nWM6ElDs"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="dNXizWJn"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="nWM6ElDs"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="dNXizWJn" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 697A853810; Fri, 19 Jan 2024 15:27:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705678025; cv=none; b=TJ/uj0NjPTg1qNQZGy4x6Oyps4vR7wpuWl3Ozn7gzm5Qwptp+CtgvjQat4tM4t3X2Wn9L8F4FKbUHPALNlVHRHPlVMh09zH/8zaDv+gUSciVdqL6Eu1aelVr+kQyEhmoXsC5vL0XPOHopGSnA0KCS3hL1gxEVLuH2PNUFSmzYAg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705678025; c=relaxed/simple; bh=19rSRL58dOC4OZ9Gg2gm/OwItV5wyPowOqlclDsjcp8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ey6sB3WtBhW4PRq5hJFlNEhdT4CJX1oaeOzdlqoniOdc/feBUBO1P66arTMjj91H11NDyqv409hmu29a/Ode6KLbd8g/kHDhtwymUBz0DkznlvzYPSYuCnnhSALPUBW7BTyc99gtPbTeSFxE8tW9HE+BGdvVk4yhXa5NfpXgcSM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=nWM6ElDs; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=dNXizWJn; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=nWM6ElDs; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=dNXizWJn; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 546DF1F7F9; Fri, 19 Jan 2024 15:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1705678020; 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=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; b=nWM6ElDsO70gVDzIpw/X5OmojQFWVg/b/CD497QQi7snPAYNYzEHuJ7rHYQtoiNDT59S/A a/Pqa7Dr7xQkI/kI5ceavl0ALoQFu1u/LQz3V1mj0NcKi/KykjlIwAlGiOiawov4LB579z 8em9bFDW9httwADNp3xaJAm3RGRtQLE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1705678020; 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=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; b=dNXizWJnimFWh8EDbrLRiAzjUlrUXxZgfydlBxFe+TvWNgZaIPQfZnWGNRwtkHykTdLfSy LQ1glfjwFfUmSsAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1705678020; 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=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; b=nWM6ElDsO70gVDzIpw/X5OmojQFWVg/b/CD497QQi7snPAYNYzEHuJ7rHYQtoiNDT59S/A a/Pqa7Dr7xQkI/kI5ceavl0ALoQFu1u/LQz3V1mj0NcKi/KykjlIwAlGiOiawov4LB579z 8em9bFDW9httwADNp3xaJAm3RGRtQLE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1705678020; 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=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; b=dNXizWJnimFWh8EDbrLRiAzjUlrUXxZgfydlBxFe+TvWNgZaIPQfZnWGNRwtkHykTdLfSy LQ1glfjwFfUmSsAQ== Received: from imap1.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 49B831388C; Fri, 19 Jan 2024 15:27:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 5N/2EcSUqmUxRQAAD6G6ig (envelope-from ); Fri, 19 Jan 2024 15:27:00 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id DB033A0803; Fri, 19 Jan 2024 16:26:59 +0100 (CET) Date: Fri, 19 Jan 2024 16:26:59 +0100 From: Jan Kara To: Kemeng Shi Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, akpm@linux-foundation.org, tj@kernel.org, xiujianfeng@huawei.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c Message-ID: <20240119152659.fvfk2axsd2pwhebk@quack3> References: <20240118203339.764093-1-shikemeng@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240118203339.764093-1-shikemeng@huaweicloud.com> Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=nWM6ElDs; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=dNXizWJn X-Spamd-Result: default: False [5.29 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BAYES_SPAM(5.10)[100.00%]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.cz:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[10]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.cz:dkim,suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: 5.29 X-Rspamd-Queue-Id: 546DF1F7F9 X-Spam-Level: ***** X-Spam-Flag: NO X-Spamd-Bar: +++++ On Fri 19-01-24 04:33:39, Kemeng Shi wrote: > The wb_wakeup_delayed is only used in fs-writeback.c. Move it to > fs-writeback.c after defination of wb_wakeup and make it static. > > Signed-off-by: Kemeng Shi Yeah, not sure why it was left there. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/fs-writeback.c | 25 +++++++++++++++++++++++++ > include/linux/backing-dev.h | 1 - > mm/backing-dev.c | 25 ------------------------- > 3 files changed, 25 insertions(+), 26 deletions(-) > > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c > index 1767493dffda..5ab1aaf805f7 100644 > --- a/fs/fs-writeback.c > +++ b/fs/fs-writeback.c > @@ -141,6 +141,31 @@ static void wb_wakeup(struct bdi_writeback *wb) > spin_unlock_irq(&wb->work_lock); > } > > +/* > + * This function is used when the first inode for this wb is marked dirty. It > + * wakes-up the corresponding bdi thread which should then take care of the > + * periodic background write-out of dirty inodes. Since the write-out would > + * starts only 'dirty_writeback_interval' centisecs from now anyway, we just > + * set up a timer which wakes the bdi thread up later. > + * > + * Note, we wouldn't bother setting up the timer, but this function is on the > + * fast-path (used by '__mark_inode_dirty()'), so we save few context switches > + * by delaying the wake-up. > + * > + * We have to be careful not to postpone flush work if it is scheduled for > + * earlier. Thus we use queue_delayed_work(). > + */ > +static void wb_wakeup_delayed(struct bdi_writeback *wb) > +{ > + unsigned long timeout; > + > + timeout = msecs_to_jiffies(dirty_writeback_interval * 10); > + spin_lock_irq(&wb->work_lock); > + if (test_bit(WB_registered, &wb->state)) > + queue_delayed_work(bdi_wq, &wb->dwork, timeout); > + spin_unlock_irq(&wb->work_lock); > +} > + > static void finish_writeback_work(struct bdi_writeback *wb, > struct wb_writeback_work *work) > { > diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h > index 1a97277f99b1..8e7af9a03b41 100644 > --- a/include/linux/backing-dev.h > +++ b/include/linux/backing-dev.h > @@ -38,7 +38,6 @@ struct backing_dev_info *bdi_alloc(int node_id); > > void wb_start_background_writeback(struct bdi_writeback *wb); > void wb_workfn(struct work_struct *work); > -void wb_wakeup_delayed(struct bdi_writeback *wb); > > void wb_wait_for_completion(struct wb_completion *done); > > diff --git a/mm/backing-dev.c b/mm/backing-dev.c > index 1e3447bccdb1..039dc74b505a 100644 > --- a/mm/backing-dev.c > +++ b/mm/backing-dev.c > @@ -372,31 +372,6 @@ static int __init default_bdi_init(void) > } > subsys_initcall(default_bdi_init); > > -/* > - * This function is used when the first inode for this wb is marked dirty. It > - * wakes-up the corresponding bdi thread which should then take care of the > - * periodic background write-out of dirty inodes. Since the write-out would > - * starts only 'dirty_writeback_interval' centisecs from now anyway, we just > - * set up a timer which wakes the bdi thread up later. > - * > - * Note, we wouldn't bother setting up the timer, but this function is on the > - * fast-path (used by '__mark_inode_dirty()'), so we save few context switches > - * by delaying the wake-up. > - * > - * We have to be careful not to postpone flush work if it is scheduled for > - * earlier. Thus we use queue_delayed_work(). > - */ > -void wb_wakeup_delayed(struct bdi_writeback *wb) > -{ > - unsigned long timeout; > - > - timeout = msecs_to_jiffies(dirty_writeback_interval * 10); > - spin_lock_irq(&wb->work_lock); > - if (test_bit(WB_registered, &wb->state)) > - queue_delayed_work(bdi_wq, &wb->dwork, timeout); > - spin_unlock_irq(&wb->work_lock); > -} > - > static void wb_update_bandwidth_workfn(struct work_struct *work) > { > struct bdi_writeback *wb = container_of(to_delayed_work(work), > -- > 2.30.0 > -- Jan Kara SUSE Labs, CR