Skip to contentSkip to conversation

Improvements to page writeback commit policy

PATCH RESEND In review Trond Myklebust 4 participants 12 messages Jun 20, 2017 – Jun 23, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Improvements to page writeback commit policy

The following patches are intended to smooth out the page writeback performance by ensuring that we commit the data earlier on the server.

We assume that if something is starting writeback on the pages, then that process wants to commit the data as soon as possible, whether it is an application or just the background flush process.
We also assume that for streaming type processes, we don't want to pause the I/O in order to commit, so we don't want to rely on a counter of in-flight I/O to the entire inode going to zero.

We therefore set up a monitor that counts the number of in-flight writes for each call to nfs_writepages(). Once all the writes to that call to nfs_writepages has completed, we send the commit. Note that this mirrors the behaviour for O_DIRECT writes, where we similarly track the in-flight writes on a per-call basis.

Trond Myklebust (3):
NFS: Remove unused fields in the page I/O structures
NFS: Ensure we commit after writeback is complete
NFS: Fix commit policy for non-blocking calls to nfs_write_inode()

 fs/nfs/pagelist.c        |  5 ++--
 fs/nfs/write.c           | 59 +++++++++++++++++++++++++++++++++++++++++++++++-
 include/linux/nfs_page.h |  2 +-
 include/linux/nfs_xdr.h  |  3 ++-
 4 files changed, 64 insertions(+), 5 deletions(-)
Signature · 1 line
2.9.4
#1 lore raw

PATCH RESEND 1/3 NFS: Remove unused fields in the page I/O structures

Remove the 'layout_private' fields that were only used by the pNFS OSD layout driver.

---
 fs/nfs/pagelist.c        | 2 --
 include/linux/nfs_page.h | 1 -
 include/linux/nfs_xdr.h  | 1 -
 3 files changed, 4 deletions(-)
fs/nfs/pagelist.c +0 -2
index ad92b401326c..de107d866297 100644
@@ -51,7 +51,6 @@ void nfs_pgheader_init(struct nfs_pageio_descriptor *desc,
 	hdr->io_start = req_offset(hdr->req);
 	hdr->good_bytes = mirror->pg_count;
 	hdr->dreq = desc->pg_dreq;
-	hdr->layout_private = desc->pg_layout_private;
 	hdr->release = release;
 	hdr->completion_ops = desc->pg_completion_ops;
 	if (hdr->completion_ops->init_hdr)
@@ -711,7 +710,6 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
 	desc->pg_error = 0;
 	desc->pg_lseg = NULL;
 	desc->pg_dreq = NULL;
-	desc->pg_layout_private = NULL;
 	desc->pg_bsize = bsize;
 
 	desc->pg_mirror_count = 1;
include/linux/nfs_page.h +0 -1
index 247cc3d3498f..6138cf91346b 100644
@@ -94,7 +94,6 @@ struct nfs_pageio_descriptor {
 	const struct nfs_pgio_completion_ops *pg_completion_ops;
 	struct pnfs_layout_segment *pg_lseg;
 	struct nfs_direct_req	*pg_dreq;
-	void			*pg_layout_private;
 	unsigned int		pg_bsize;	/* default bsize for mirrors */
 
 	u32			pg_mirror_count;
include/linux/nfs_xdr.h +0 -1
index b28c83475ee8..ee998ed08cf6 100644
@@ -1436,7 +1436,6 @@ struct nfs_pgio_header {
 	const struct nfs_pgio_completion_ops *completion_ops;
 	const struct nfs_rw_ops	*rw_ops;
 	struct nfs_direct_req	*dreq;
-	void			*layout_private;
 	spinlock_t		lock;
 	/* fields protected by lock */
 	int			pnfs_error;
Signature · 1 line
2.9.4
#2 lore raw

PATCH RESEND 2/3 NFS: Ensure we commit after writeback is complete

If the page cache is being flushed, then we want to ensure that we do start a commit once the pages are done being flushed. If we just wait until all I/O is done to that file, we can end up livelocking until the balance_dirty_pages() mechanism puts its foot down and forces I/O to stop.
So instead we do more or less the same thing that O_DIRECT does, and set up a counter to tell us when the flush is done,

---
 fs/nfs/pagelist.c        |  3 +++
 fs/nfs/write.c           | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/nfs_page.h |  1 +
 include/linux/nfs_xdr.h  |  2 ++
 4 files changed, 63 insertions(+)
fs/nfs/pagelist.c +3 -0
index de107d866297..83d2918f1b13 100644
@@ -50,6 +50,7 @@ void nfs_pgheader_init(struct nfs_pageio_descriptor *desc,
 	hdr->cred = hdr->req->wb_context->cred;
 	hdr->io_start = req_offset(hdr->req);
 	hdr->good_bytes = mirror->pg_count;
+	hdr->io_completion = desc->pg_io_completion;
 	hdr->dreq = desc->pg_dreq;
 	hdr->release = release;
 	hdr->completion_ops = desc->pg_completion_ops;
@@ -709,6 +710,7 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
 	desc->pg_ioflags = io_flags;
 	desc->pg_error = 0;
 	desc->pg_lseg = NULL;
+	desc->pg_io_completion = NULL;
 	desc->pg_dreq = NULL;
 	desc->pg_bsize = bsize;
 
@@ -1231,6 +1233,7 @@ int nfs_pageio_resend(struct nfs_pageio_descriptor *desc,
 {
 	LIST_HEAD(failed);
 
+	desc->pg_io_completion = hdr->io_completion;
 	desc->pg_dreq = hdr->dreq;
 	while (!list_empty(&hdr->pages)) {
 		struct nfs_page *req = nfs_list_entry(hdr->pages.next);
fs/nfs/write.c +57 -0

105 lines not on this page · raw message

include/linux/nfs_page.h +1 -0
index 6138cf91346b..abbee2d15dce 100644
@@ -93,6 +93,7 @@ struct nfs_pageio_descriptor {
 	const struct rpc_call_ops *pg_rpc_callops;
 	const struct nfs_pgio_completion_ops *pg_completion_ops;
 	struct pnfs_layout_segment *pg_lseg;
+	struct nfs_io_completion *pg_io_completion;
 	struct nfs_direct_req	*pg_dreq;
 	unsigned int		pg_bsize;	/* default bsize for mirrors */
 
include/linux/nfs_xdr.h +2 -0
index ee998ed08cf6..ab6a8381459f 100644
@@ -1422,6 +1422,7 @@ enum {
 	NFS_IOHDR_STAT,
 };
 
+struct nfs_io_completion;
 struct nfs_pgio_header {
 	struct inode		*inode;
 	struct rpc_cred		*cred;
@@ -1435,6 +1436,7 @@ struct nfs_pgio_header {
 	void (*release) (struct nfs_pgio_header *hdr);
 	const struct nfs_pgio_completion_ops *completion_ops;
 	const struct nfs_rw_ops	*rw_ops;
+	struct nfs_io_completion *io_completion;
 	struct nfs_direct_req	*dreq;
 	spinlock_t		lock;
 	/* fields protected by lock */
Signature · 1 line
2.9.4
#3 lore raw

PATCH RESEND 3/3 NFS: Fix commit policy for non-blocking calls to nfs_write_inode()

Now that the writes will schedule a commit on their own, we don't need nfs_write_inode() to schedule one if there are outstanding writes, and we're being called in non-blocking mode.

---
 fs/nfs/write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/write.c +1 -1
index 051197cb9195..b1af5dee5e0a 100644
@@ -1941,7 +1941,7 @@ int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 		/* Don't commit yet if this is a non-blocking flush and there
 		 * are a lot of outstanding writes for this mapping.
 		 */
-		if (nfsi->commit_info.ncommit <= (nfsi->nrequests >> 1))
+		if (mapping_tagged(inode->i_mapping, PAGECACHE_TAG_WRITEBACK))
 			goto out_mark_dirty;
 
 		/* don't wait for the COMMIT response */
Signature · 1 line
2.9.4
#4 lore raw

PATCH 1/1 SUNRPC: Make slot allocation more reliable

In xprt_alloc_slot(), the spin lock is only needed to provide atomicity between the atomic_add_unless() failure and the call to xprt_add_backlog(). We do not actually need to hold it across the memory allocation itself.

By dropping the lock, we can use a more resilient GFP_NOFS allocation, just as we now do in the rest of the RPC client code.

---
 net/sunrpc/xprt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
net/sunrpc/xprt.c +5 -3
index 3e63c5e97ebe..4654a9934269 100644
@@ -1047,13 +1047,15 @@ static bool xprt_throttle_congested(struct rpc_xprt *xprt, struct rpc_task *task
 	return ret;
 }
 
-static struct rpc_rqst *xprt_dynamic_alloc_slot(struct rpc_xprt *xprt, gfp_t gfp_flags)
+static struct rpc_rqst *xprt_dynamic_alloc_slot(struct rpc_xprt *xprt)
 {
 	struct rpc_rqst *req = ERR_PTR(-EAGAIN);
 
 	if (!atomic_add_unless(&xprt->num_reqs, 1, xprt->max_reqs))
 		goto out;
-	req = kzalloc(sizeof(struct rpc_rqst), gfp_flags);
+	spin_unlock(&xprt->reserve_lock);
+	req = kzalloc(sizeof(struct rpc_rqst), GFP_NOFS);
+	spin_lock(&xprt->reserve_lock);
 	if (req != NULL)
 		goto out;
 	atomic_dec(&xprt->num_reqs);
@@ -1081,7 +1083,7 @@ void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task)
 		list_del(&req->rq_list);
 		goto out_init_req;
 	}
-	req = xprt_dynamic_alloc_slot(xprt, GFP_NOWAIT|__GFP_NOWARN);
+	req = xprt_dynamic_alloc_slot(xprt);
 	if (!IS_ERR(req))
 		goto out_init_req;
 	switch (PTR_ERR(req)) {
Signature · 1 line
2.9.4
#5 lore raw
In reply to Trond Myklebust
Quoted 13 lines · Trond Myklebust

The following patches are intended to smooth out the page writeback performance by ensuring that we commit the data earlier on the server.

We assume that if something is starting writeback on the pages, then that process wants to commit the data as soon as possible, whether it is an application or just the background flush process.
We also assume that for streaming type processes, we don't want to pause the I/O in order to commit, so we don't want to rely on a counter of in-flight I/O to the entire inode going to zero.

Quoted 5 lines

We therefore set up a monitor that counts the number of in-flight writes for each call to nfs_writepages(). Once all the writes to that call to nfs_writepages has completed, we send the commit. Note that this mirrors the behaviour for O_DIRECT writes, where we similarly track the in-flight writes on a per-call basis.

These are the same as the patches you sent May 16th? I am trying to get a little time to try them out.

Quoted 5 lines

Trond Myklebust (3):
NFS: Remove unused fields in the page I/O structures
NFS: Ensure we commit after writeback is complete
NFS: Fix commit policy for non-blocking calls to nfs_write_inode()

Quoted 13 lines
fs/nfs/pagelist.c        |  5 ++--
fs/nfs/write.c           | 59 +++++++++++++++++++++++++++++++++++++++++++++++-
include/linux/nfs_page.h |  2 +-
include/linux/nfs_xdr.h  |  3 ++-
4 files changed, 64 insertions(+), 5 deletions(-)
Signature · 6 lines
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever

#6 lore raw
Quoted 16 lines · Chuck Lever
Quoted 14 lines · Trond Myklebust

The following patches are intended to smooth out the page writeback performance by ensuring that we commit the data earlier on the server.

We assume that if something is starting writeback on the pages, then that process wants to commit the data as soon as possible, whether it is an application or just the background flush process.
We also assume that for streaming type processes, we don't want to pause the I/O in order to commit, so we don't want to rely on a counter of in-flight I/O to the entire inode going to zero.

Quoted 8 lines
Quoted 5 lines

We therefore set up a monitor that counts the number of in-flight writes for each call to nfs_writepages(). Once all the writes to that call to nfs_writepages has completed, we send the commit. Note that this mirrors the behaviour for O_DIRECT writes, where we similarly track the in-flight writes on a per-call basis.

These are the same as the patches you sent May 16th? I am trying to get a little time to try them out.

After applying these four patches, I ran a series of iozone benchmarks with buffered and direct I/O. NFSv3 and NFSv4.0 on RDMA. Exports were tmpfs and xfs on NVMe.

I see about a 10% improvement in buffered write throughput, no degradation elsewhere, and no crashes or other misbehav- ior.

xfstests passes with the usual few failures.

Buffered write throughput is still limited to 1GBps when targeting a tmpfs export on a 5.6GBps network. The server isn't breaking a sweat, but the client appears to be hit- ting some spin locks pretty hard. This is similar behavior to before the patches were applied.

Quoted 24 lines
Quoted 5 lines

Trond Myklebust (3):
NFS: Remove unused fields in the page I/O structures
NFS: Ensure we commit after writeback is complete
NFS: Fix commit policy for non-blocking calls to nfs_write_inode()

Quoted 13 lines
fs/nfs/pagelist.c        |  5 ++--
fs/nfs/write.c           | 59 +++++++++++++++++++++++++++++++++++++++++++++++-
include/linux/nfs_page.h |  2 +-
include/linux/nfs_xdr.h  |  3 ++-
4 files changed, 64 insertions(+), 5 deletions(-)
Signature · 6 lines
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Chuck Lever

#7 lore raw

T24gRnJpLCAyMDE3LTA2LTIzIGF0IDE2OjQ4IC0wNDAwLCBDaHVjayBMZXZlciB3cm90ZToNCj4g PiBPbiBKdW4gMjEsIDIwMTcsIGF0IDEwOjMxIEFNLCBDaHVjayBMZXZlciA8Y2h1Y2subGV2ZXJA b3JhY2xlLmNvbT4NCj4gPiB3cm90ZToNCj4gPiANCj4g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jkb21vQHZnZXIua2VybmVsLm9yZw0K PiA+IE1vcmUgbWFqb3Jkb21vIGluZm8gYXTCoMKgaHR0cDovL3ZnZXIua2VybmVsLm9yZy9tYWpv cmRvbW8taW5mby5odG1sDQo+IA0KPiAtLQ0KPiBDaHVjayBMZXZlcg0KPiANCj4gDQo+IA0KLS0g DQpUcm9uZCBNeWtsZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lciwgUHJpbWFyeURh dGENCnRyb25kLm15a2xlYnVzdEBwcmltYXJ5ZGF0YS5jb20NCg==

#8 lore raw
Quoted 52 lines · Trond Myklebust
Quoted 35 lines · Chuck Lever
Quoted 32 lines
Quoted 20 lines · Chuck Lever

On Jun 20, 2017, at 7:35 PM, Trond Myklebust <trond.myklebust@pri marydata.com> wrote:

The following patches are intended to smooth out the page writeback
performance by ensuring that we commit the data earlier on the server.

We assume that if something is starting writeback on the pages, then
that process wants to commit the data as soon as possible, whether it
is an application or just the background flush process. We also assume that for streaming type processes, we don't want to pause
the I/O in order to commit, so we don't want to rely on a counter of
in-flight I/O to the entire inode going to zero.

Quoted 8 lines

We therefore set up a monitor that counts the number of in-flight writes for each call to nfs_writepages(). Once all the writes to that
call to nfs_writepages has completed, we send the commit. Note that this
mirrors the behaviour for O_DIRECT writes, where we similarly track the
in-flight writes on a per-call basis.

Quoted 2 lines

These are the same as the patches you sent May 16th? I am trying to get a little time to try them out.

Quoted 7 lines

After applying these four patches, I ran a series of iozone benchmarks with buffered and direct I/O. NFSv3 and NFSv4.0 on RDMA. Exports were tmpfs and xfs on NVMe.

I see about a 10% improvement in buffered write throughput, no degradation elsewhere, and no crashes or other misbehav- ior.

Cool! Thanks for testing.

Quoted 3 lines

xfstests passes with the usual few failures.

Quoted 8 lines
Quoted 5 lines

Buffered write throughput is still limited to 1GBps when targeting a tmpfs export on a 5.6GBps network. The server isn't breaking a sweat, but the client appears to be hit- ting some spin locks pretty hard. This is similar behavior to before the patches were applied.

Just out of curiosity, do you see the same behaviour with O_DIRECT against the tmpfs?

No.

Quoted 3 lines

There are 2 differences there:
1) no inode_lock(inode) contention.
2) slighly less inode->i_lock spinlock contention.

Here's buffered I/O, 1MB rsize/wsize:

	Include close in write timing
	Command line used: /home/cel/bin/iozone -i0 -i1 -s4g -y1k -az -c
	Output is in kBytes/sec
	Time Resolution = 0.000001 seconds.
	Processor cache size set to 1024 kBytes.
	Processor cache line size set to 32 bytes.
	File stride size set to 17 * record size.

              kB  reclen    write  rewrite    read    reread
         4194304       1   534253   570782  1445754  1354491
         4194304       2   734277   853665  2204343  2023764
         4194304       4   960679  1097920  3364254  2935551
         4194304       8   966103  1167984  4105734  3508967
         4194304      16  1035137  1218580  4251939  3626800
         4194304      32  1071914  1263524  4529706  3813485
         4194304      64  1078425  1221345  4631985  3865276
         4194304     128  1088618  1292963  4516240  3755776
         4194304     256  1076105  1236686  4148944  3535090
         4194304     512  1055872  1285594  4236854  3588770
         4194304    1024  1074738  1257684  4248442  3598040
         4194304    2048  1080189  1232026  4283919  3622818
         4194304    4096  1060772  1282839  4268281  3605311
         4194304    8192  1035067  1216913  3409080  2977354
         4194304   16384  1027003  1206250  2671951  2396517  

Here's direct I/O, 1MB rsize/wsize:

	O_DIRECT feature enabled
	Command line used: /home/cel/bin/iozone -i0 -i1 -s128m -y1k -az -I
	Output is in kBytes/sec
	Time Resolution = 0.000001 seconds.
	Processor cache size set to 1024 kBytes.
	Processor cache line size set to 32 bytes.
	File stride size set to 17 * record size.
                                    
              kB  reclen    write  rewrite    read    reread
          131072       1    23010    23523    25882    25831
          131072       2    45174    46255    51357    51406
          131072       4    69723    71039    93943    93880
          131072       8   131892   135438   179759   182036
          131072      16   245077   252067   335448   335486
          131072      32   415335   445705   600465   606896
          131072      64   647643   702595   923036   960093
          131072     128   910638   914057  1291528  1356444
          131072     256  1164078  1164266  1534979  1585828
          131072     512  1088692  1312085  1871873  1856387
          131072    1024  1243072  1363032  1858835  1925179
          131072    2048  1664066  1831074  2538926  2598939
          131072    4096  2205889  2392262  3608012  3686869
          131072    8192  2544002  2310414  4546863  4493238
          131072   16384  2597748  2164045  3629498  5016898
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
Quoted 16 lines

Trond Myklebust (3):
NFS: Remove unused fields in the page I/O structures
NFS: Ensure we commit after writeback is complete
NFS: Fix commit policy for non-blocking calls to nfs_write_inode()

fs/nfs/pagelist.c聽聽聽聽聽聽聽聽|聽聽5 ++--
fs/nfs/write.c聽聽聽聽聽聽聽聽聽聽聽| 59
+++++++++++++++++++++++++++++++++++++++++++++++-
include/linux/nfs_page.h |聽聽2 +-
include/linux/nfs_xdr.h聽聽|聽聽3 ++-

4 files changed, 64 insertions(+), 5 deletions(-)

--聽
2.9.4

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux- nfs" in
the body of a message to [email protected]
More majordomo info at聽聽http://vger.kernel.org/majordomo-info.htm l

--
Chuck Lever

--
To unsubscribe from this list: send the line "unsubscribe linux- nfs" in
the body of a message to [email protected]
More majordomo info at聽聽http://vger.kernel.org/majordomo-info.html

Quoted 10 lines
Quoted 5 lines

--
Chuck Lever

Signature · 4 lines
Trond Myklebust
Linux NFS client maintainer, PrimaryData
[email protected]
��N嫥叉靣笡y氊b瞂千v豝�)藓{.n�+壏{睗�"炟^n噐■��侂h櫒璀�&Ⅷ�瓽珴閔��(殠娸"濟���m��飦赇z罐枈帼f"穐殘坢

--
Chuck Lever

#9 lore raw
In reply to Trond Myklebust
Quoted 2 lines · Trond Myklebust

The following patches are intended to smooth out the page writeback performance by ensuring that we commit the data earlier on the server.

Was there some particular benchmark or hardware setup that motivated doing this now?

--b.

Quoted 32 lines

We assume that if something is starting writeback on the pages, then that process wants to commit the data as soon as possible, whether it is an application or just the background flush process.
We also assume that for streaming type processes, we don't want to pause the I/O in order to commit, so we don't want to rely on a counter of in-flight I/O to the entire inode going to zero.

We therefore set up a monitor that counts the number of in-flight writes for each call to nfs_writepages(). Once all the writes to that call to nfs_writepages has completed, we send the commit. Note that this mirrors the behaviour for O_DIRECT writes, where we similarly track the in-flight writes on a per-call basis.

Trond Myklebust (3):
NFS: Remove unused fields in the page I/O structures
NFS: Ensure we commit after writeback is complete
NFS: Fix commit policy for non-blocking calls to nfs_write_inode()

 fs/nfs/pagelist.c        |  5 ++--
 fs/nfs/write.c           | 59 +++++++++++++++++++++++++++++++++++++++++++++++-
 include/linux/nfs_page.h |  2 +-
 include/linux/nfs_xdr.h  |  3 ++-
 4 files changed, 64 insertions(+), 5 deletions(-)
Signature · 6 lines
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

T24gRnJpLCAyMDE3LTA2LTIzIGF0IDEwOjU2IC0wNDAwLCBKLiBCcnVjZSBGaWVsZHMgd3JvdGU6 DQo+IE9uIFR1ZSwgSnVuIDIwLCAyMDE3IGF0IDA3OjM1OjM1UE0gLTA0MDAsIFRyb25kIE15a2xl YnVzdCB3cm90ZToNCj4gPiBUaGUgZm9sbG93aW5nIHBhdGNoZXMgYXJlIGludGVuZGVkIHRvIHNt b290aCBvdXQgdGhlIHBhZ2Ugd3JpdGViYWNrDQo+ID4gcGVyZm9ybWFuY2UgYnkgZW5zdXJpbmcg dGhhdCB3ZSBjb21taXQgdGhlIGRhdGEgZWFybGllciBvbiB0aGUNCj4gPiBzZXJ2ZXIuDQo+IA0K PiBXYXMgdGhlcmUgc29tZSBwYXJ0aWN1bGFyIGJlbmNobWFyayBvciBoYXJkd2FyZSBzZXR1cCB0 aGF0IG1vdGl2YXRlZA0KPiBkb2luZyB0aGlzIG5vdz8NCg0KSSBmaW5hbGx5IGhhZCBlbm91Z2gg ZnJlZSB0aW1lIHRvIHN0dWR5IHRoZSBwcm9ibGVtIG9mIHdoeSBteSBiYWNrdXBzDQpmcm9tIG15 IGxhcHRvcCB0byBteSBOQVMgYmFja3VwIGRldmljZSB0b29rIHNvIGxvbmcgdG8gY29tcGxldGU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