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=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 B5A9BC4332B for ; Tue, 2 Mar 2021 09:49:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7AB7E64F0A for ; Tue, 2 Mar 2021 09:49:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379035AbhCBJir (ORCPT ); Tue, 2 Mar 2021 04:38:47 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:43872 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837912AbhCBJKp (ORCPT ); Tue, 2 Mar 2021 04:10:45 -0500 Received: from epcas3p1.samsung.com (unknown [182.195.41.19]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210302091002epoutp02fed549d4a6f1737ae9d49a1dcb5580e7~oe3N95Dth0378803788epoutp02- for ; Tue, 2 Mar 2021 09:10:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210302091002epoutp02fed549d4a6f1737ae9d49a1dcb5580e7~oe3N95Dth0378803788epoutp02- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1614676202; bh=O31FVF9w9jaxLxUzUwYA/nvnejdGzFszkeQF7lstuOI=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=WC6zzbMVz131or/4bzIVJNDvdKGamYMGVFuXVCE68I+EcKEfdxs2aq+BrE+EV91bi QVTIxBdMWOm6E3hCb61lw0ea7iZGfVVsGNwGGh2io1g+wbTXW3si0MjPt95jAiv0SY 6RlVPYQpdRFy1w6zlBjJTQmCKTyaNKgVFS6pHIjo= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas3p1.samsung.com (KnoxPortal) with ESMTP id 20210302091001epcas3p1c8d434a344e81ac45f34b96ab67e0f17~oe3NVbKVU3071630716epcas3p1F; Tue, 2 Mar 2021 09:10:01 +0000 (GMT) Received: from epcpadp3 (unknown [182.195.40.17]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4DqWYP4gyhz4x9Q8; Tue, 2 Mar 2021 09:10:01 +0000 (GMT) Mime-Version: 1.0 Subject: RE: RE: [PATCH v4 7/9] scsi: ufshpb: Add "Cold" regions timer Reply-To: daejun7.park@samsung.com Sender: Daejun Park From: Daejun Park To: Avri Altman , Daejun Park , "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 , ALIM AKHTAR , "asutoshd@codeaurora.org" , Zang Leigang , Avi Shchislowski , Bean Huo , "cang@codeaurora.org" , "stanley.chu@mediatek.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: 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: <2038148563.21614676201654.JavaMail.epsvc@epcpadp3> Date: Tue, 02 Mar 2021 18:04:29 +0900 X-CMS-MailID: 20210302090429epcms2p443de88c14298f707577122e6a91b9a82 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: 20210226083459epcas2p1862e3e2c18208074336cc9faf14a7139 References: <20210226083300.30934-8-avri.altman@wdc.com> <20210226083300.30934-1-avri.altman@wdc.com> <878274034.81614673683390.JavaMail.epsvc@epcpadp4> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Avri, > > > > Hi Avri, > > > > > +static void ufshpb_read_to_handler(struct work_struct *work) > > > +{ > > > + struct delayed_work *dwork = to_delayed_work(work); > > > + struct ufshpb_lu *hpb; > > > + struct victim_select_info *lru_info; > > > + struct ufshpb_region *rgn; > > > + unsigned long flags; > > > + LIST_HEAD(expired_list); > > > + > > > + hpb = container_of(dwork, struct ufshpb_lu, ufshpb_read_to_work); > > > + > > > + if (test_and_set_bit(TIMEOUT_WORK_PENDING, &hpb- > > >work_data_bits)) > > > + return; > > > + > > > + spin_lock_irqsave(&hpb->rgn_state_lock, flags); > > > + > > > + lru_info = &hpb->lru_info; > > > + > > > + list_for_each_entry(rgn, &lru_info->lh_lru_rgn, list_lru_rgn) { > > > + bool timedout = ktime_after(ktime_get(), rgn->read_timeout); > > > + > > > + if (timedout) { > > > > It is important not just to check the timeout, but how much time has passed. > > If the time exceeded is twice the threshold, the read_timeout_expiries > > value should be reduced by 2 instead of 1. > Theoretically this shouldn't happened. > Please note that POLLING_INTERVAL_MS << READ_TO_MS. > Better add appropriate check when making those configurable. OK, I agree. Thanks, Daejun > > Thanks, > Avri > > > > > + rgn->read_timeout_expiries--; > > > > Thanks, > > Daejun > > > >