[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200520102634.pin4mzyytmfqtuo2@linutronix.de>
Date: Wed, 20 May 2020 12:26:34 +0200
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Song Bao Hua <song.bao.hua@...ilicon.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Will Deacon <will@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Paul E . McKenney" <paulmck@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Luis Claudio R. Goncalves" <lgoncalv@...hat.com>,
Seth Jennings <sjenning@...hat.com>,
Dan Streetman <ddstreet@...e.org>,
Vitaly Wool <vitaly.wool@...sulko.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Linuxarm <linuxarm@...wei.com>
Subject: Re: [PATCH 8/8] mm/zswap: Use local lock to protect per-CPU data
On 2020-05-19 21:46:06 [+0000], Song Bao Hua wrote:
> Hi Luis,
> In the below patch, in order to use the acomp APIs to leverage the power of hardware compressors. I have moved to mutex:
> https://marc.info/?l=linux-crypto-vger&m=158941285830302&w=2
> https://marc.info/?l=linux-crypto-vger&m=158941287930311&w=2
>
> so once we get some progress on that one, I guess we don't need a special patch for RT any more.
If you convert this way from the current concept then we could drop it
from the series.
The second patch shows the following hunk:
|@@ -1075,11 +1124,20 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,
|
| /* compress */
| dst = get_cpu_var(zswap_dstmem);
| acomp_ctx = *this_cpu_ptr(entry->pool->acomp_ctx);
| put_cpu_var(zswap_dstmem);
So here you get per-CPU version of `dst' and `acomp_ctx' and then allow
preemption again.
| mutex_lock(&acomp_ctx->mutex);
|
| src = kmap(page);
| sg_init_one(&input, src, PAGE_SIZE);
| /* zswap_dstmem is of size (PAGE_SIZE * 2). Reflect same in sg_list */
| sg_init_one(&output, dst, PAGE_SIZE * 2);
and here you use `dst' and `acomp_ctx' after the preempt_disable() has
been dropped so I don't understand why you used get_cpu_var(). It is
either protected by the mutex and doesn't require get_cpu_var() or it
isn't (and should have additional protection).
| acomp_request_set_params(acomp_ctx->req, &input, &output, PAGE_SIZE, dlen);
| ret = crypto_wait_req(crypto_acomp_compress(acomp_ctx->req), &acomp_ctx->wait);
| dlen = acomp_ctx->req->dlen;
| kunmap(page);
|
| if (ret) {
| ret = -EINVAL;
| goto put_dstmem;
|
Sebastian
Powered by blists - more mailing lists