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 X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDC42C432BE for ; Mon, 9 Aug 2021 15:10:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 57CD960F8F for ; Mon, 9 Aug 2021 15:10:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 57CD960F8F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B49098D0001; Mon, 9 Aug 2021 11:10:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD2536B0071; Mon, 9 Aug 2021 11:10:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 972D98D0001; Mon, 9 Aug 2021 11:10:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id 7906A6B006C for ; Mon, 9 Aug 2021 11:10:53 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 204A418039527 for ; Mon, 9 Aug 2021 15:10:53 +0000 (UTC) X-FDA: 78455879586.28.C344703 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf06.hostedemail.com (Postfix) with ESMTP id 9EA6B801AB24 for ; Mon, 9 Aug 2021 15:10:52 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 300281FFFE; Mon, 9 Aug 2021 15:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1628521851; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=atlo+NKpDCTCwZ+7e0Seb6ZvJdkbk7+6VcZA+tEAelY=; b=c/zsLCNQKeumCIxTiEcdWgfEDGcQHDy91K994MFxGQ4076JkmRJZlYy8Pma2zcJoGNt73A +vjbUfTuU6Pl5Thm5zvxkFVY2fYtIKGsrDmAxnbqDLT+cZtc9qgNh+lM8L7NcNNS2ZJL1w ZzOCvYkKEeCQ2KLICXZWRuoH7mr94b0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1628521851; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=atlo+NKpDCTCwZ+7e0Seb6ZvJdkbk7+6VcZA+tEAelY=; b=Dwdl7Ioju78ovvw3zBk5O60RylkYJghFcimUW6fMrUywG8vev4HpLDT8neW8a5v/GqlI9a xSkpv15AFa2NQwBA== Received: from quack2.suse.cz (jack.udp.ovpn1.prg.suse.de [10.100.224.230]) by relay2.suse.de (Postfix) with ESMTP id 1B08FA3B8E; Mon, 9 Aug 2021 15:10:51 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 70ACF1E3BFC; Mon, 9 Aug 2021 17:10:48 +0200 (CEST) Date: Mon, 9 Aug 2021 17:10:48 +0200 From: Jan Kara To: Christoph Hellwig Cc: Jens Axboe , Tejun Heo , Jan Kara , linux-block@vger.kernel.org, Andrew Morton , cgroups@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/5] mm: hide laptop_mode_wb_timer entirely behind the BDI API Message-ID: <20210809151048.GE30319@quack2.suse.cz> References: <20210809141744.1203023-1-hch@lst.de> <20210809141744.1203023-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210809141744.1203023-2-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="c/zsLCNQ"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=Dwdl7Ioj; dmarc=none; spf=pass (imf06.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz X-Stat-Signature: 1oywqheok3ffoxz5au7sotnaf6qu6c35 X-Rspamd-Queue-Id: 9EA6B801AB24 X-Rspamd-Server: rspam01 X-HE-Tag: 1628521852-267309 Content-Transfer-Encoding: quoted-printable 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: On Mon 09-08-21 16:17:40, Christoph Hellwig wrote: > Don't leak the deta=D1=96ls of the timer into the block layer, instead > initialize the timer in bdi_alloc and delete it in bdi_unregister. > Note that this means the timer is initialized (but not armed) for > non-block queues as well now. >=20 > Signed-off-by: Christoph Hellwig Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > block/blk-core.c | 5 ----- > mm/backing-dev.c | 3 +++ > mm/page-writeback.c | 2 -- > 3 files changed, 3 insertions(+), 7 deletions(-) >=20 > diff --git a/block/blk-core.c b/block/blk-core.c > index 04477697ee4b..5897bc37467d 100644 > --- a/block/blk-core.c > +++ b/block/blk-core.c > @@ -394,10 +394,7 @@ void blk_cleanup_queue(struct request_queue *q) > /* for synchronous bio-based driver finish in-flight integrity i/o */ > blk_flush_integrity(); > =20 > - /* @q won't process any more request, flush async actions */ > - del_timer_sync(&q->backing_dev_info->laptop_mode_wb_timer); > blk_sync_queue(q); > - > if (queue_is_mq(q)) > blk_mq_exit_queue(q); > =20 > @@ -546,8 +543,6 @@ struct request_queue *blk_alloc_queue(int node_id) > =20 > atomic_set(&q->nr_active_requests_shared_sbitmap, 0); > =20 > - timer_setup(&q->backing_dev_info->laptop_mode_wb_timer, > - laptop_mode_timer_fn, 0); > timer_setup(&q->timeout, blk_rq_timed_out_timer, 0); > INIT_WORK(&q->timeout_work, blk_timeout_work); > INIT_LIST_HEAD(&q->icq_list); > diff --git a/mm/backing-dev.c b/mm/backing-dev.c > index f5561ea7d90a..cd06dca232c3 100644 > --- a/mm/backing-dev.c > +++ b/mm/backing-dev.c > @@ -807,6 +807,7 @@ struct backing_dev_info *bdi_alloc(int node_id) > bdi->capabilities =3D BDI_CAP_WRITEBACK | BDI_CAP_WRITEBACK_ACCT; > bdi->ra_pages =3D VM_READAHEAD_PAGES; > bdi->io_pages =3D VM_READAHEAD_PAGES; > + timer_setup(&bdi->laptop_mode_wb_timer, laptop_mode_timer_fn, 0); > return bdi; > } > EXPORT_SYMBOL(bdi_alloc); > @@ -928,6 +929,8 @@ static void bdi_remove_from_list(struct backing_dev= _info *bdi) > =20 > void bdi_unregister(struct backing_dev_info *bdi) > { > + del_timer_sync(&bdi->laptop_mode_wb_timer); > + > /* make sure nobody finds us on the bdi_list anymore */ > bdi_remove_from_list(bdi); > wb_shutdown(&bdi->wb); > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > index 9f63548f247c..c12f67cbfa19 100644 > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -2010,7 +2010,6 @@ int dirty_writeback_centisecs_handler(struct ctl_= table *table, int write, > return ret; > } > =20 > -#ifdef CONFIG_BLOCK > void laptop_mode_timer_fn(struct timer_list *t) > { > struct backing_dev_info *backing_dev_info =3D > @@ -2045,7 +2044,6 @@ void laptop_sync_completion(void) > =20 > rcu_read_unlock(); > } > -#endif > =20 > /* > * If ratelimit_pages is too high then we can get into dirty-data over= load > --=20 > 2.30.2 >=20 --=20 Jan Kara SUSE Labs, CR