Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3478681pxj; Sun, 20 Jun 2021 22:39:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3RoC5k3ac7ZiixG4MdZiSIvsHpfEwlAYtjLjj4v5y2JLTxPmsfEDgm8r5H/EwLam03uvp X-Received: by 2002:a17:906:dbe1:: with SMTP id yd1mr4178088ejb.114.1624253973308; Sun, 20 Jun 2021 22:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624253973; cv=none; d=google.com; s=arc-20160816; b=cGX6gWU9GjUwJunyRyID6joUeDJ1SrNJFf+nGTySdgcI/ej6kuLUtTgd9dzyNwsvdb pmT6PpsKCsJT1W7yrie4TZbcdwaoTvulN3TUhbBez12XbUVmQqcOkxWwk7LOsDEu0ELu LiXRGpwIsg96CLTwOl0MazOWA2mGGQ7/wmxswpzv9aZgS3Vajd6O6BTcZwsoAe34o23A NRq/uySAUirhgP/ECnklcvQm5IDHV0RuA3qysOtW5N5NiMrxWie7QZTZKt7+sNQ16HxO orubfeetiH9FayZYQ0up9kacOTbeo3wj1dT5xEgmprjBnmyUOmz/WFUW74rTETAa+QSD /xbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:content-transfer-encoding:date :message-id:in-reply-to:cc:to:from:sender:reply-to:subject :mime-version:dkim-signature:dkim-filter; bh=/JNeiseTrnaIKRNZL2o3iW/AjK3zc5cFVTM3H9aTY6Y=; b=Vjgwo8Ijecs1/MDpOehWuS6q0J69HFG+L0FAPVvtBmq7wTpHk4aU+B5Ayw+7u8oeTV UcTQFa3GCLZWqtxbF0N3NlfCFdU7coHWeFGX1V+Q/Gxhnvi1Zf6hKZBtVVgXS7zfcqxh QgJBfNo+wSgtSFVUO6CZCLquGr0uUDQFGEccmCB2zu35R/L7Ekyqks3vseimsrFYobMO 8d8BK1fkOBo6ddLFSAlOTZNWfbwagiEVG3lCh3sT+Va5/iQvOiWzr1N1yHyLtT3jyGjB MVmziUsdeHyXjXQ09YSET67OTVju83ffDBfYp70koSdUf48DmJ5wGTjeqbLJe0dY5WsJ t1Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kCJhMFpR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ml14si393288ejb.205.2021.06.20.22.39.11; Sun, 20 Jun 2021 22:39:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kCJhMFpR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229641AbhFUFkT (ORCPT + 99 others); Mon, 21 Jun 2021 01:40:19 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:41770 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbhFUFkR (ORCPT ); Mon, 21 Jun 2021 01:40:17 -0400 Received: from epcas3p4.samsung.com (unknown [182.195.41.22]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210621053802epoutp021e81d28bf7d8ec85ce37378b308fd3b7~Kgkzd-qf51837018370epoutp029 for ; Mon, 21 Jun 2021 05:38:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210621053802epoutp021e81d28bf7d8ec85ce37378b308fd3b7~Kgkzd-qf51837018370epoutp029 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1624253882; bh=/JNeiseTrnaIKRNZL2o3iW/AjK3zc5cFVTM3H9aTY6Y=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=kCJhMFpR1mJrFbM44r7zgOX2MjOAxLkAAw2pcTnoQ0fVYC3Rg97/6Ny37/sPKULuh x25doBRHK4CN4Nhwk5ips6zpoMWtI2cURuY1NI5WssL4WpREGYLUNRz0uxFyaB8D7p Gfe9Ri5BVqZEooI0l4wU8t2eD1SOMU9fNBUlkZWQ= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas3p2.samsung.com (KnoxPortal) with ESMTP id 20210621053801epcas3p2c88967920c133151263d26de4cab2136~Kgky2e-452419524195epcas3p26; Mon, 21 Jun 2021 05:38:01 +0000 (GMT) Received: from epcpadp4 (unknown [182.195.40.18]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4G7dbY43sDz4x9Q0; Mon, 21 Jun 2021 05:38:01 +0000 (GMT) Mime-Version: 1.0 Subject: RE: [PATCH v11 08/12] scsi: ufshpb: Add "Cold" regions timer Reply-To: daejun7.park@samsung.com Sender: Daejun Park From: Daejun Park To: "James E . J . Bottomley" , "Martin K . Petersen" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: "gregkh@linuxfoundation.org" , Bart Van Assche , yongmyung lee , Daejun Park , ALIM AKHTAR , "asutoshd@codeaurora.org" , Zang Leigang , Avi Shchislowski , Bean Huo , "cang@codeaurora.org" , "stanley.chu@mediatek.com" , Avri Altman X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20210616112800.52963-9-avri.altman@wdc.com> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <1891546521.01624253881548.JavaMail.epsvc@epcpadp4> Date: Mon, 21 Jun 2021 14:17:33 +0900 X-CMS-MailID: 20210621051733epcms2p1dd6b54d0142845e865285385dda43a43 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y X-Hop-Count: 3 X-CMS-RootMailID: 20210616112925epcas2p1267d33aee5fa552333a0503207e262f2 References: <20210616112800.52963-9-avri.altman@wdc.com> <20210616112800.52963-1-avri.altman@wdc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Avri, >diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c >index 39b86e8b2eee..cf719831adb3 100644 >--- a/drivers/scsi/ufs/ufshpb.c >+++ b/drivers/scsi/ufs/ufshpb.c ... >+static void ufshpb_read_to_handler(struct work_struct *work) >+{ >+ struct ufshpb_lu *hpb = container_of(work, struct ufshpb_lu, >+ ufshpb_read_to_work.work); >+ struct victim_select_info *lru_info = &hpb->lru_info; >+ struct ufshpb_region *rgn, *next_rgn; >+ unsigned long flags; >+ LIST_HEAD(expired_list); >+ >+ if (test_and_set_bit(TIMEOUT_WORK_RUNNING, &hpb->work_data_bits)) >+ return; >+ >+ spin_lock_irqsave(&hpb->rgn_state_lock, flags); >+ >+ list_for_each_entry_safe(rgn, next_rgn, &lru_info->lh_lru_rgn, >+ list_lru_rgn) { >+ bool timedout = ktime_after(ktime_get(), rgn->read_timeout); >+ >+ if (timedout) { >+ rgn->read_timeout_expiries--; >+ if (is_rgn_dirty(rgn) || >+ rgn->read_timeout_expiries == 0) >+ list_add(&rgn->list_expired_rgn, &expired_list); Why we need additional expired_list for updating inactive information? And I think "rgn->list_lru_rgn" should be deleted when it is expired. >+ else >+ rgn->read_timeout = ktime_add_ms(ktime_get(), >+ READ_TO_MS); >+ } >+ } >+ >+ spin_unlock_irqrestore(&hpb->rgn_state_lock, flags); >+ >+ list_for_each_entry_safe(rgn, next_rgn, &expired_list, >+ list_expired_rgn) { >+ list_del_init(&rgn->list_expired_rgn); >+ spin_lock_irqsave(&hpb->rsp_list_lock, flags); >+ ufshpb_update_inactive_info(hpb, rgn->rgn_idx); >+ spin_unlock_irqrestore(&hpb->rsp_list_lock, flags); >+ } >+ >+ ufshpb_kick_map_work(hpb); >+ >+ clear_bit(TIMEOUT_WORK_RUNNING, &hpb->work_data_bits); >+ >+ schedule_delayed_work(&hpb->ufshpb_read_to_work, >+ msecs_to_jiffies(POLLING_INTERVAL_MS)); >+} >+ Thanks, Daejun