Message ID | 20201015142416.70294-2-roger.pau@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xen/blkback: add LRU purge parameters | expand |
On 15.10.20 16:24, Roger Pau Monne wrote: > 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é <roger.pau@citrix.com> > --- > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > Cc: Jens Axboe <axboe@kernel.dk> > Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> > Cc: SeongJae Park <sjpark@amazon.de> > Cc: xen-devel@lists.xenproject.org > Cc: linux-block@vger.kernel.org > Cc: J. Roeleveld <joost@antarean.org> > Cc: Jürgen Groß <jgross@suse.com> > --- > 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/Documentation/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 s/lru_internval/lru_interval/ > +Date: October 2020 > +KernelVersion: 5.10 > +Contact: Roger Pau Monné <roger.pau@citrix.com> > +Description: > + The LRU mechanism to clean the lists of persistent grants needs > + to be executed periodically. This parameter controls the time > + interval between consecutive executions of the purge mechanism > + is set in ms. > diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/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 of pages to be used for the > * be executed periodically. The time interval between consecutive executions > * of the purge mechanism is set in ms. > */ > -#define LRU_INTERVAL 100 > +static unsigned int lru_interval = 100; > +module_param_named(lru_interval, lru_interval, uint, 0644); > +MODULE_PARM_DESC(lru_internval, s/lru_internval/lru_interval/ > + "Time interval between consecutive executions of the cache purge mechanism (in ms)"); > > /* > * 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 != vbd_sz(vbd))) > xen_vbd_resize(blkif); > > - timeout = msecs_to_jiffies(LRU_INTERVAL); > + timeout = msecs_to_jiffies(lru_interval); > > timeout = 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 = jiffies + msecs_to_jiffies(LRU_INTERVAL); > + ring->next_lru = jiffies + msecs_to_jiffies(lru_interval); > } > > /* Shrink the free pages pool if it is too large. */ > Juergen
On Thu, 15 Oct 2020 16:24:15 +0200 Roger Pau Monne <roger.pau@citrix.com> wrote: > 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é <roger.pau@citrix.com> > --- > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > Cc: Jens Axboe <axboe@kernel.dk> > Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> > Cc: SeongJae Park <sjpark@amazon.de> > Cc: xen-devel@lists.xenproject.org > Cc: linux-block@vger.kernel.org > Cc: J. Roeleveld <joost@antarean.org> > Cc: Jürgen Groß <jgross@suse.com> > --- > 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/Documentation/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é <roger.pau@citrix.com> > +Description: > + The LRU mechanism to clean the lists of persistent grants needs > + to be executed periodically. This parameter controls the time > + interval between consecutive executions of the purge mechanism > + is set in ms. I think noticing the default value (100ms) here would be better. Thanks, SeongJae Park
diff --git a/Documentation/ABI/testing/sysfs-driver-xen-blkback b/Documentation/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é <roger.pau@citrix.com> +Description: + The LRU mechanism to clean the lists of persistent grants needs + to be executed periodically. This parameter controls the time + interval between consecutive executions of the purge mechanism + is set in ms. diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/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 of pages to be used for the * be executed periodically. The time interval between consecutive executions * of the purge mechanism is set in ms. */ -#define LRU_INTERVAL 100 +static unsigned int lru_interval = 100; +module_param_named(lru_interval, lru_interval, uint, 0644); +MODULE_PARM_DESC(lru_internval, + "Time interval between consecutive executions of the cache purge mechanism (in ms)"); /* * 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 != vbd_sz(vbd))) xen_vbd_resize(blkif); - timeout = msecs_to_jiffies(LRU_INTERVAL); + timeout = msecs_to_jiffies(lru_interval); timeout = 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 = jiffies + msecs_to_jiffies(LRU_INTERVAL); + ring->next_lru = jiffies + msecs_to_jiffies(lru_interval); } /* Shrink the free pages pool if it is too large. */
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é <roger.pau@citrix.com> --- Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: SeongJae Park <sjpark@amazon.de> Cc: xen-devel@lists.xenproject.org Cc: linux-block@vger.kernel.org Cc: J. Roeleveld <joost@antarean.org> Cc: Jürgen Groß <jgross@suse.com> --- Documentation/ABI/testing/sysfs-driver-xen-blkback | 10 ++++++++++ drivers/block/xen-blkback/blkback.c | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-)