Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4831304pxu; Tue, 22 Dec 2020 01:46:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPeLs8Gi5kF6TOO76C5Hpbxjs8hqvjCwGOTsbeQHcLYgp8ghjUj6X86di6TrQFm6IAQe06 X-Received: by 2002:a17:906:c09:: with SMTP id s9mr19085088ejf.539.1608630401763; Tue, 22 Dec 2020 01:46:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608630401; cv=none; d=google.com; s=arc-20160816; b=TCXQWl2UlxaaQgSMI9pU3j+Yp6KXDiEVYtUdlcIsAEwx70fTkcpr/sSL/LzhxyZj/m QxlKrqQpNh5zT9+SK9RrRJVHNtNIDqB6r0GXYCxaElrHN3NTz3yD80sxizjMNcQqZlPW BThBs3KdqZ4hZlsmd+zx4fklo2AFtJJzGTqUTZKHNMHxiEDW7JFo1bUOk3WaC3qBYEQ8 Kywgr711jN3FL+HRomhG9oCsUWIz5t0wqmmw/YgzJvHd/qlCPhIHKfFtAsz0Tmq4P0Lh gA1kPXvzC70/1cPPihGXliX77u5Kjmlnr7B8zDentt4HllE+FCNweVq2VGw8ahothVcu CbLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=r18epwnRXAAeayNJqVatwdsRgeDOVYhFQb9Xlfe0Jcw=; b=HC7MoB+wkf/5OCJm8MDy+pkADsiZCp5k8/OuJY2S2RrL2z/V2Vl63PNVKrs+1ep+lT YVz4oACSgW5MPrblOfVK8bANgPULRnCTdxit5mooszGM4P/45hgD5kh8EfDwvW2gUjB7 M0VeQvkCAW4qXREwBcc7nSrJXvH7yCmgPiAGxu0BTFIh9p9Xn+psv7AzTRLJvHSubjlO Ei83otJJFZgcsdyRTTf4K//HssYl2z9BweORnv557YdQSSdasJphstrhU4ycxxBgwjk3 RWjpLCLSo4mFdGF5BA34Ppg2phg/2u9a1iIC6n6kKt7FsTEka0P4Q+vmGYMnbSMPw2KM w3Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@konsulko.com header.s=google header.b=OqmApOAo; 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 z23si13310856edl.270.2020.12.22.01.46.19; Tue, 22 Dec 2020 01:46:41 -0800 (PST) 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; dkim=pass header.i=@konsulko.com header.s=google header.b=OqmApOAo; 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 S1725854AbgLVJpF (ORCPT + 99 others); Tue, 22 Dec 2020 04:45:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725833AbgLVJpF (ORCPT ); Tue, 22 Dec 2020 04:45:05 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1F3EC0613D3 for ; Tue, 22 Dec 2020 01:44:24 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id o19so30568428lfo.1 for ; Tue, 22 Dec 2020 01:44:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=r18epwnRXAAeayNJqVatwdsRgeDOVYhFQb9Xlfe0Jcw=; b=OqmApOAo4JAUPhMDwOsf2TTVhUc2ozQSpwxJixURCslXdBDYUDflFO7isq3J3274FA NuFhqJBbxwL2xOS8VCoYQ3kQWveiXyNL+eSNTsTosRGPcLDDAd04CQs92r9J/6+Kc/uv ND4T3j2gGmDBV71u+zAP0nYjjhTmpco04/iCk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=r18epwnRXAAeayNJqVatwdsRgeDOVYhFQb9Xlfe0Jcw=; b=rmV+cR6W7HVM0bl1J6/jxyeTNIrcM4c+rNUso1mXx5kcZffh3H5e1dOV4lOlPBkIDg 3DR+4SvhMZMm8wKy0RZRvFEcR62NSZiNZY7cylxsPl9yvACGDumT3zY4fMShRfSz3x7J t7IAVmpfMS9fPia3ZkN2aBC3DMyKr3BKKLlFGtkNlqADOV3uPgOK426qUAJsTzoNC9b5 TzeDz20BwfR/sVXKdF8jgs/Yme6WZTrDPlGOVYZpya1LY5zD9KwvzJhVSgv2RxoZhcEd MpAC/iBmUjABD4uWkZIImaQNadnkwudd9P0eG0kgd+Z3XYr/pLULpSXbaoB+q4NpolIo q1hw== X-Gm-Message-State: AOAM532J4sF4shpcgTZkvEU3bLdJJS9yoOmoxPi2Ldlh2sZOQu8PpFAJ eOknF9UUmiCCX9s7xbp+tp+3BKebJdQbfKMFImhz7g== X-Received: by 2002:ac2:5edb:: with SMTP id d27mr8062026lfq.411.1608630263565; Tue, 22 Dec 2020 01:44:23 -0800 (PST) MIME-Version: 1.0 References: <18669bd607ae9efbf4e00e36532c7aa167d0fa12.camel@gmx.de> <20201220002228.38697-1-vitaly.wool@konsulko.com> <8cc0e01fd03245a4994f2e0f54b264fa@hisilicon.com> <4490cb6a7e2243fba374e40652979e46@hisilicon.com> <08cbef1e43634c4099709be8e99e5d27@hisilicon.com> In-Reply-To: <08cbef1e43634c4099709be8e99e5d27@hisilicon.com> From: Vitaly Wool Date: Tue, 22 Dec 2020 10:44:12 +0100 Message-ID: Subject: Re: [PATCH] zsmalloc: do not use bit_spin_lock To: "Song Bao Hua (Barry Song)" Cc: Shakeel Butt , Minchan Kim , Mike Galbraith , LKML , linux-mm , Sebastian Andrzej Siewior , NitinGupta , Sergey Senozhatsky , Andrew Morton , "tiantao (H)" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 22 Dec 2020, 03:11 Song Bao Hua (Barry Song), wrote: > > > > > -----Original Message----- > > From: Song Bao Hua (Barry Song) > > Sent: Tuesday, December 22, 2020 3:03 PM > > To: 'Vitaly Wool' > > Cc: Shakeel Butt ; Minchan Kim ; Mike > > Galbraith ; LKML ; linux-mm > > ; Sebastian Andrzej Siewior ; > > NitinGupta ; Sergey Senozhatsky > > ; Andrew Morton > > ; tiantao (H) > > Subject: RE: [PATCH] zsmalloc: do not use bit_spin_lock > > > > > > > I'm still not convinced. Will kmap what, src? At this point src might become > > just a bogus pointer. > > > > As long as the memory is still there, we can kmap it by its page struct. But > > if > > it is not there anymore, we have no way. > > > > > Why couldn't the object have been moved somewhere else (due to the compaction > > mechanism for instance) > > > at the time DMA kicks in? > > > > So zs_map_object() will guarantee the src won't be moved by holding those > > preemption-disabled lock? > > If so, it seems we have to drop the MOVABLE gfp in zswap for zsmalloc case? > > > > Or we can do get_page() to avoid the movement of the page. I would like to discuss this more in zswap context than zsmalloc's. Since zsmalloc does not implement reclaim callback, using it in zswap is a corner case anyway. zswap, on the other hand, may be dealing with some new backends in future which have more chances to become mainstream. Imagine typical NUMA-like cases, i. e. a zswap pool allocated in some kind SRAM, or in unused video memory. In such a case if you try to use a pointer to an invalidated zpool mapping, you are on the way to thrash the system. So: no assumptions that the zswap pool is in regular linear RAM should be made. ~Vitaly > > > > > > > > > > > > > ~Vitaly > > > > > > > Thanks > > Barry > >