Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp435605ybk; Wed, 20 May 2020 03:28:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ+I/ZofEDuK/lPLKuhjgP+6OuE3WYbawBigiFfrCNhpLBDdK3rPrVGzuEqQQ+1hkAx2DK X-Received: by 2002:a50:e002:: with SMTP id e2mr2769433edl.179.1589970527292; Wed, 20 May 2020 03:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589970527; cv=none; d=google.com; s=arc-20160816; b=uQb/Q5pjr6l2M2B0bs6X0nsRmlwOrft9oUlYUERLbctf/LUysEbLYFBGOgDND0Ndky +S1GyKNW70iN+RwVUGXU1JTIApWboTRmPHkc6afnyH//1J9q75B5NwzEHJAfv2iZowDg gCaxGidgQc5cDUFvORMNlnc36Ci9vTnFsCZWIxjCUvfVd8ANZb41MPOdN1fdkghYnIQ8 1KOPU5CYrfIRoV28Ot/RhoU+GjJ4efy0ViYKhsHcXzKTb3PL/9LdhDy9oG8JJxtLfyq5 MBowxDVD123J1fpwhzZZISHyR3AcshxoHAWox6PLscOIJdkwtfiWdpw6ca+SyVSSc6pd NaVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ZRtNDqo2se8oWo+SC+1gUTOplbbH7X8DQ9GA2ZhJnVw=; b=TUH1dxylUISdr4DnvLwL9rGjJdXCbMfUSIxWpalPttqRnxyD9VBuaV7Dd/VZOVS615 pRJgXExwyPFW2rzK/jkhgRdnKre9VyJFqyf2SXGxeHwGEXD1RHzI4zP2+eVJhUQBlI6J Yd4NwBjhh7PcyH3yiXOTRLpAxsECSXXF1ao5amZM1fhAUCujFsYxJfwvLZovdkJVNZD8 HnSCjmlxLD5G8z/5uP+qco4wX7ZB8MC/qmhA0IX1+ohLa78FxpX/+53bTH7hBw6Gn3hG 3+wovELQfzzpPxE4P1IUzXBgsn3sQ9z1/oeEmRr3KRxhF4ww9+v1aQ+eiF4C6k0ujt/P h63g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb25si1412819ejb.177.2020.05.20.03.28.23; Wed, 20 May 2020 03:28:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbgETK0l (ORCPT + 99 others); Wed, 20 May 2020 06:26:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgETK0k (ORCPT ); Wed, 20 May 2020 06:26:40 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7821C061A0E for ; Wed, 20 May 2020 03:26:40 -0700 (PDT) Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1jbLvm-00053v-Dk; Wed, 20 May 2020 12:26:34 +0200 Date: Wed, 20 May 2020 12:26:34 +0200 From: Sebastian Andrzej Siewior To: Song Bao Hua Cc: "linux-kernel@vger.kernel.org" , Peter Zijlstra , Ingo Molnar , Steven Rostedt , Will Deacon , Thomas Gleixner , "Paul E . McKenney" , Linus Torvalds , "Luis Claudio R. Goncalves" , Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , "linux-mm@kvack.org" , Linuxarm Subject: Re: [PATCH 8/8] mm/zswap: Use local lock to protect per-CPU data Message-ID: <20200520102634.pin4mzyytmfqtuo2@linutronix.de> References: <20200519201912.1564477-1-bigeasy@linutronix.de> <20200519201912.1564477-9-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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