From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCF7BC433E0 for ; Tue, 22 Dec 2020 09:44:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 663802310D for ; Tue, 22 Dec 2020 09:44:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 663802310D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DA71B6B0074; Tue, 22 Dec 2020 04:44:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D7E956B0082; Tue, 22 Dec 2020 04:44:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C95E06B0088; Tue, 22 Dec 2020 04:44:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id B25456B0074 for ; Tue, 22 Dec 2020 04:44:25 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7D9458249980 for ; Tue, 22 Dec 2020 09:44:25 +0000 (UTC) X-FDA: 77620432890.08.route74_0e112dc2745f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 641141819E624 for ; Tue, 22 Dec 2020 09:44:25 +0000 (UTC) X-HE-Tag: route74_0e112dc2745f X-Filterd-Recvd-Size: 5598 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Dec 2020 09:44:24 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id a12so30500130lfl.6 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=fFYbS6VlVpWZdf2TFscegJaL19aH9nZQ9ehNCmnRAncftphVwvI/6gIEL6WjDsTKFY 019LXhQa9XTWSoaUnu/TzDpDyJT9vwfYjm+/B/E0n5VVFXQFTr+esTPQPQJdcIdm3Whs gqxg4LcD46dQ0sQn9RVyvFxkQnaeZDqLGyAQy6Dz/pKkwV0Q8BZcDTOw6PdkRt3u9pIM +7DnMGvQXhZiLkzWdeqccQW/7jl7VfOMpeo+b52Yw7MtuCICsl6zIBtUrOtYwPv0DUKu NvYVzA+Cj5NmMeWziV0Ra2UfGSvXudzlhYF77qSYQyKjoufP/36EgElndakynCah8Wyb 7Lag== X-Gm-Message-State: AOAM533Bnua2cT7rkLypENybc+ddKD5xTgGEZjr5MpPdSQvpJ0G74R1e CV9l2G0pc31iEy7e8k++1aGuOduXbNkSLKErvSN6ow== X-Google-Smtp-Source: ABdhPJxBj0pE0ztPrxO5n9jP5KWgTe312/IA644ZpoKFdBZy8LgZsWnVSg7wCCgAbGqXMWSFcqG+esVUtM487SJzZCw= 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" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > >