From nobody Fri Apr 26 00:18:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1602771983; cv=none; d=zohomail.com; s=zohoarc; b=npR0nJM8v2CK/OEA0Nkr+gids/R5f+IeC0fQYlvqIGTG1Fq9zTkGvqzs2Pjiu8XUxU98IlEZboJnBRupu+57vx5zaQ0QafGVbDwDNzpP3vHqBmw8+LZmFTymXeLsID7MhhAofuUodyOZheVGWAKg80H8l2FN6S9gAfbC8RXrZVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602771983; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PV0E3RM///LldhmwdbVkP/FDl9NiDdXBwWl8WC+GJ3M=; b=QRpptM43tfAmY3hQDM+B9dJ4ujDMesyRkBbqwcpqZh1Do46P6p8QMcMCmo2NpAwaBmmFqv1+FcgB75uou8KXoaiSVRDrsOdm+U3SQhesGL+sXSlZ7SPJ/k77/I0EPRUFSdNCeFyLzwS5G1DMKgLiZkMqNkI5NMFfb7tKZVE4Hkk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1602771983489285.8319280329225; Thu, 15 Oct 2020 07:26:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.7418.19382 (Exim 4.92) (envelope-from ) id 1kT4Ck-0004jB-7x; Thu, 15 Oct 2020 14:26:06 +0000 Received: by outflank-mailman (output) from mailman id 7418.19382; Thu, 15 Oct 2020 14:26:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kT4Ck-0004j3-3L; Thu, 15 Oct 2020 14:26:06 +0000 Received: by outflank-mailman (input) for mailman id 7418; Thu, 15 Oct 2020 14:26:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kT4Ci-0004im-Up for xen-devel@lists.xenproject.org; Thu, 15 Oct 2020 14:26:04 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5b31eb84-11a5-4017-bcc3-ed083e0a1e0e; Thu, 15 Oct 2020 14:26:03 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kT4Ci-0004im-Up for xen-devel@lists.xenproject.org; Thu, 15 Oct 2020 14:26:04 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5b31eb84-11a5-4017-bcc3-ed083e0a1e0e; Thu, 15 Oct 2020 14:26:03 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5b31eb84-11a5-4017-bcc3-ed083e0a1e0e DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1602771963; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nec4gD5X3MmxS0I+tIlw7vXxkm0qi/q39D7bqb697+c=; b=HHdCFMYdp3iaiytTJKwwuZXXhBJuVSTxYO1RZ3dMYNibrbr2a4k1Lf8W h36r2U2wmCpY1PXpCQdgw0XxhrRWMt0fkpnKnu9SjBfJJUPvARX99CGGQ MvgBIhO5ITQu2SjW3B1t5gju0nnWS/237zPuSacssCCqCyxuQTl1K7C/e U=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: iDE2yqknkOfC10XRaSF9d4E7CcP5Q7x0CCeK4aQp5Q1/nZv/prDXfC+SlM5ci1UypwQ6cB1QW+ Rl8ICdJBrilb1/wW5SOKfXC43Dd3QJpWshFMC/Mu6GwUhqTT1AsidtLjSrF0UP9RjAgeNOlQ79 8HTIxkcBb2U8ycE40/DnqPu0OXqxHm6i21NwnLMHnvEgjCF+aZN/ES0ZdS0A8AuJi3b9RvwYcM ZD4BGKRh2YA84jLWIu2a3ImyVJs3BdlrheZginPypI7gTI5wlbJDTrAusT9k6r+iiKjqi7gyug CCw= X-SBRS: 2.5 X-MesageID: 29146562 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.77,379,1596513600"; d="scan'208";a="29146562" From: Roger Pau Monne To: CC: Roger Pau Monne , Konrad Rzeszutek Wilk , Jens Axboe , Boris Ostrovsky , SeongJae Park , , , "J . Roeleveld" , =?UTF-8?q?J=C3=BCrgen=20Gro=C3=9F?= Subject: [PATCH 1/2] xen/blkback: turn the cache purge LRU interval into a parameter Date: Thu, 15 Oct 2020 16:24:15 +0200 Message-ID: <20201015142416.70294-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201015142416.70294-1-roger.pau@citrix.com> References: <20201015142416.70294-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) Assume that reads and writes to the variable will be atomic. The worse that could happen is that one of the LRU intervals is not calculated properly if a partially written value is read, but that would only be a transient issue. Signed-off-by: Roger Pau Monn=C3=A9 --- Cc: Konrad Rzeszutek Wilk Cc: Jens Axboe Cc: Boris Ostrovsky Cc: SeongJae Park Cc: xen-devel@lists.xenproject.org Cc: linux-block@vger.kernel.org Cc: J. Roeleveld Cc: J=C3=BCrgen Gro=C3=9F --- Documentation/ABI/testing/sysfs-driver-xen-blkback | 10 ++++++++++ drivers/block/xen-blkback/blkback.c | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-xen-blkback b/Documenta= tion/ABI/testing/sysfs-driver-xen-blkback index ecb7942ff146..776f25d335ca 100644 --- a/Documentation/ABI/testing/sysfs-driver-xen-blkback +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkback @@ -35,3 +35,13 @@ Description: controls the duration in milliseconds that blkback will not cache any page not backed by a grant mapping. The default is 10ms. + +What: /sys/module/xen_blkback/parameters/lru_internval +Date: October 2020 +KernelVersion: 5.10 +Contact: Roger Pau Monn=C3=A9 +Description: + The LRU mechanism to clean the lists of persistent grants = needs + to be executed periodically. This parameter controls the t= ime + interval between consecutive executions of the purge mecha= nism + is set in ms. diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkbac= k/blkback.c index adfc9352351d..6ad9b76fdb2b 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -117,7 +117,10 @@ MODULE_PARM_DESC(max_ring_page_order, "Maximum order o= f pages to be used for the * be executed periodically. The time interval between consecutive executi= ons * of the purge mechanism is set in ms. */ -#define LRU_INTERVAL 100 +static unsigned int lru_interval =3D 100; +module_param_named(lru_interval, lru_interval, uint, 0644); +MODULE_PARM_DESC(lru_internval, + "Time interval between consecutive executions of the cache purge mechan= ism (in ms)"); =20 /* * When the persistent grants list is full we will remove unused grants @@ -620,7 +623,7 @@ int xen_blkif_schedule(void *arg) if (unlikely(vbd->size !=3D vbd_sz(vbd))) xen_vbd_resize(blkif); =20 - timeout =3D msecs_to_jiffies(LRU_INTERVAL); + timeout =3D msecs_to_jiffies(lru_interval); =20 timeout =3D wait_event_interruptible_timeout( ring->wq, @@ -650,7 +653,7 @@ int xen_blkif_schedule(void *arg) if (blkif->vbd.feature_gnt_persistent && time_after(jiffies, ring->next_lru)) { purge_persistent_gnt(ring); - ring->next_lru =3D jiffies + msecs_to_jiffies(LRU_INTERVAL); + ring->next_lru =3D jiffies + msecs_to_jiffies(lru_interval); } =20 /* Shrink the free pages pool if it is too large. */ --=20 2.28.0 From nobody Fri Apr 26 00:18:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1602771961; cv=none; d=zohomail.com; s=zohoarc; b=a5mABcrBBF9E/vmuCXvU+VtvWyrTkt4BDTB3367IS2JolJWP3H2wq+d0VMEzfzkjtpT/MfTNo1k/D5I28Xw3c5kTTDnNDQNiwt4TMLFc6Ew/wZkEwPNE52QgyqZ0M1SukP0w1BseOtyk9XcjcJl7g1MuyrhA9RfkumDzu8fROlM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602771961; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qNgoB8o00zbH6ppDROYSHfqiPHGe6IvaH+BYxxuvi84=; b=nUxuQg/wukVo/bCFYJ/NT+l8/gAJtthDNrwkyvaz4dcWVCwLhtF0TKe9M2AZS55ZWkmtIQvDLrH6OL8/jYN0xm3BXAhdmQCt09nmsRsTWMqZvmMaez5yVZfgEN7BvEmTdC742UVNh8nMDL0VBJyBZ0BKBFg05qWr2paeagOnlhU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1602771961151658.2631303021356; Thu, 15 Oct 2020 07:26:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.7415.19370 (Exim 4.92) (envelope-from ) id 1kT4CO-0004bX-ST; Thu, 15 Oct 2020 14:25:44 +0000 Received: by outflank-mailman (output) from mailman id 7415.19370; Thu, 15 Oct 2020 14:25:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kT4CO-0004bP-P8; Thu, 15 Oct 2020 14:25:44 +0000 Received: by outflank-mailman (input) for mailman id 7415; Thu, 15 Oct 2020 14:25:43 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kT4CN-0004ay-GJ for xen-devel@lists.xenproject.org; Thu, 15 Oct 2020 14:25:43 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ef1122d1-2b9c-4702-bf1d-9b0e24451e7e; Thu, 15 Oct 2020 14:25:42 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kT4CN-0004ay-GJ for xen-devel@lists.xenproject.org; Thu, 15 Oct 2020 14:25:43 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ef1122d1-2b9c-4702-bf1d-9b0e24451e7e; Thu, 15 Oct 2020 14:25:42 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ef1122d1-2b9c-4702-bf1d-9b0e24451e7e DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1602771942; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qACv2ER1JyTphbaRvO3qjGjCO4Ywxs60QaM06nUJtes=; b=gnxBu0Okljz4KZnafw9fJasKLyJEsI43noBV4BEOOxucWUU4pN1ER84H bjF80Y5hs/1HClri4hmBuq7vFIimhLPWYsvfkPmAYLv9IAnnkQLZXQ4VF CBK2MfO58C+MuosMAyDCt5RM44jKzXObbfPaf1nClUSKdhETtcZa+ZNfq U=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: pc4931EzyhHOF/1+wy2nZ4XleWl7qBYyCEkp00YAxqGPWcnc737w40tXoyYSmGIVRQQH4Iit93 07qxT5ybUOhZ2qxJTCRSoPyXLgFI6SB+kOdkwJ+tnstszy0/PMaQb6jMTptLMYlA/iJY4Lf2Oi F/cLdsnFwau5CJFWfhOyvPnFRV7Fsi+iyINxA6sbSGk67l/81+RiveiaYesCDf5YPxdThZ1AFI ilb1k5+O1Wjm2wOq7NJkhCdFSBqRNJaXSmpoZMT/4v02/Y5YxNBbR02IjhXjykf3zIOuEoFlNN uzc= X-SBRS: 2.5 X-MesageID: 29332243 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.77,379,1596513600"; d="scan'208";a="29332243" From: Roger Pau Monne To: CC: Roger Pau Monne , Konrad Rzeszutek Wilk , Jens Axboe , Boris Ostrovsky , SeongJae Park , , , "J . Roeleveld" , =?UTF-8?q?J=C3=BCrgen=20Gro=C3=9F?= Subject: [PATCH 2/2] xen/blkback: turn the cache purge percent into a parameter Date: Thu, 15 Oct 2020 16:24:16 +0200 Message-ID: <20201015142416.70294-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201015142416.70294-1-roger.pau@citrix.com> References: <20201015142416.70294-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) Assume that reads and writes to the variable will be atomic. The worse that could happen is that one of the purges removes a partially written percentage of grants, but the cache itself will recover. Signed-off-by: Roger Pau Monn=C3=A9 --- Cc: Konrad Rzeszutek Wilk Cc: Jens Axboe Cc: Boris Ostrovsky Cc: SeongJae Park Cc: xen-devel@lists.xenproject.org Cc: linux-block@vger.kernel.org Cc: J. Roeleveld Cc: J=C3=BCrgen Gro=C3=9F --- Documentation/ABI/testing/sysfs-driver-xen-blkback | 9 +++++++++ drivers/block/xen-blkback/blkback.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-xen-blkback b/Documenta= tion/ABI/testing/sysfs-driver-xen-blkback index 776f25d335ca..7de791ad61f9 100644 --- a/Documentation/ABI/testing/sysfs-driver-xen-blkback +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkback @@ -45,3 +45,12 @@ Description: to be executed periodically. This parameter controls the t= ime interval between consecutive executions of the purge mecha= nism is set in ms. + +What: /sys/module/xen_blkback/parameters/lru_percent_clean +Date: October 2020 +KernelVersion: 5.10 +Contact: Roger Pau Monn=C3=A9 +Description: + When the persistent grants list is full we will remove unu= sed + grants from the list. The percent number of grants to be + removed at each LRU execution. diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkbac= k/blkback.c index 6ad9b76fdb2b..772852d45a5a 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -127,7 +127,10 @@ MODULE_PARM_DESC(lru_internval, * from the list. The percent number of grants to be removed at each LRU * execution. */ -#define LRU_PERCENT_CLEAN 5 +static unsigned int lru_percent_clean =3D 5; +module_param_named(lru_percent_clean, lru_percent_clean, uint, 0644); +MODULE_PARM_DESC(lru_percent_clean, + "Percentage of persistent grants to remove from the cache when full"); =20 /* Run-time switchable: /sys/module/blkback/parameters/ */ static unsigned int log_stats; @@ -404,7 +407,7 @@ static void purge_persistent_gnt(struct xen_blkif_ring = *ring) !ring->blkif->vbd.overflow_max_grants)) { num_clean =3D 0; } else { - num_clean =3D (max_pgrants / 100) * LRU_PERCENT_CLEAN; + num_clean =3D (max_pgrants / 100) * lru_percent_clean; num_clean =3D ring->persistent_gnt_c - max_pgrants + num_clean; num_clean =3D min(ring->persistent_gnt_c, num_clean); pr_debug("Going to purge at least %u persistent grants\n", --=20 2.28.0