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=-16.9 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 69A62C433E0 for ; Thu, 24 Dec 2020 18:28:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E9F0720C56 for ; Thu, 24 Dec 2020 18:28:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9F0720C56 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C13928D007C; Thu, 24 Dec 2020 13:28:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B9C4E8D0061; Thu, 24 Dec 2020 13:28:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A638A8D007C; Thu, 24 Dec 2020 13:28:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id 8B3A28D0061 for ; Thu, 24 Dec 2020 13:28:14 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4D390181AEF1D for ; Thu, 24 Dec 2020 18:28:14 +0000 (UTC) X-FDA: 77629010508.15.form80_471103827473 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 29DBB1814B0C1 for ; Thu, 24 Dec 2020 18:28:14 +0000 (UTC) X-HE-Tag: form80_471103827473 X-Filterd-Recvd-Size: 5253 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Thu, 24 Dec 2020 18:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=VGafzW+gDLjGLMNoybNSBGNiUL4/Bi3JEFJxz+NnDOo=; b=EhJff5vA4Ww2XgctyYRLpm5zaW fRb++J29JhQTcpWEtDdKhunxvfrubKlxzZI6mk3AeZEvGqrgkAZ8DnAxMnvlREgOTa9odqM6ubPUi 9VoylnGnIYzu+2X/G3J/CtrUMdrFMijVEKnIuYlm4v4kszYsGULZp1Nt3fBzThEONGsRLtKCj+CQs Cs8EOGH/qKHER6lmIV04pGHhCSwHwvC3qezfOo6SqzswdE6qkFIfRoLDly20ykRbeL6Gi09JsixXi 8Nam8gVIdPJVmiDV2Xtfe5/BdGo2AENkRg2yBGtTnltj64CRb0vAf5ekbHFJ55JHDuBaJzCT7AllJ 1VEiqVXQ==; Received: from [2601:1c0:6280:3f0::64ea] by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ksVKp-0007Zk-7Z; Thu, 24 Dec 2020 18:27:35 +0000 Subject: Re: [RFC V2 37/37] Add documentation for dmemfs To: yulei.kernel@gmail.com, linux-mm@kvack.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, naoya.horiguchi@nec.com, viro@zeniv.linux.org.uk, pbonzini@redhat.com Cc: joao.m.martins@oracle.com, sean.j.christopherson@intel.com, xiaoguangrong.eric@gmail.com, kernellwp@gmail.com, lihaiwei.kernel@gmail.com, Yulei Zhang References: <6a3a71f75dad1fa440677fc1bcdc170f178be1d8.1607332046.git.yuleixzhang@tencent.com> From: Randy Dunlap Message-ID: Date: Thu, 24 Dec 2020 10:27:28 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <6a3a71f75dad1fa440677fc1bcdc170f178be1d8.1607332046.git.yuleixzhang@tencent.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Hi, On 12/7/20 3:31 AM, yulei.kernel@gmail.com wrote: > From: Yulei Zhang > > Introduce dmemfs.rst to document the basic usage of dmemfs. > > Signed-off-by: Yulei Zhang > --- > Documentation/filesystems/dmemfs.rst | 58 ++++++++++++++++++++++++++++++++++++ > Documentation/filesystems/index.rst | 1 + > 2 files changed, 59 insertions(+) > create mode 100644 Documentation/filesystems/dmemfs.rst > > diff --git a/Documentation/filesystems/dmemfs.rst b/Documentation/filesystems/dmemfs.rst > new file mode 100644 > index 00000000..f13ed0c > --- /dev/null > +++ b/Documentation/filesystems/dmemfs.rst > @@ -0,0 +1,58 @@ > +.. SPDX-License-Identifier: GPL-2.0 > + > +===================================== > +The Direct Memory Filesystem - DMEMFS > +===================================== > + > + > +.. Table of contents > + > + - Overview > + - Compilation > + - Usage > + > +Overview > +======== > + > +Dmemfs (Direct Memory filesystem) is device memory or reserved > +memory based filesystem. This kind of memory is special as it > +is not managed by kernel and it is without 'struct page'. Therefore > +it can save extra memory from the host system for various usage, usages, or uses, > +especially for guest virtual machines. > + > +It uses a kernel boot parameter ``dmem=`` to reserve the system > +memory when the host system boots up, the details can be checked boots up. The detail > +in /Documentation/admin-guide/kernel-parameters.txt. > + > +Compilation > +=========== > + > +The filesystem should be enabled by turning on the kernel configuration > +options:: > + > + CONFIG_DMEM_FS - Direct Memory filesystem support > + CONFIG_DMEM - Allow reservation of memory for dmem Would anyone want DMEM_FS without DMEM? > + > + > +Additionally, the following can be turned on to aid debugging:: > + > + CONFIG_DMEM_DEBUG_FS - Enable debug information for dmem > + > +Usage > +======== > + > +Dmemfs supports mapping ``4K``, ``2M`` and ``1G`` size of pages to sizes > +the userspace, for example :: userspace. For example:: > + > + # mount -t dmemfs none -o pagesize=4K /mnt/ > + > +The it can create the backing storage with 4G size :: Then > + > + # truncate /mnt/dmemfs-uuid --size 4G > + > +To use as backing storage for virtual machine starts with qemu, just need started with qemu, just specify the memory-backed-file > +to specify the memory-backed-file in the qemu command line like this :: > + > + # -object memory-backend-file,id=ram-node0,mem-path=/mnt/dmemfs-uuid \ backed > + share=yes,size=4G,host-nodes=0,policy=preferred -numa node,nodeid=0,memdev=ram-node0 > + -- ~Randy