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=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 C8F8AC433FE for ; Mon, 7 Dec 2020 11:35:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6A8DA233A0 for ; Mon, 7 Dec 2020 11:35:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A8DA233A0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F03EF8D0012; Mon, 7 Dec 2020 06:35:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E8C8F8D0001; Mon, 7 Dec 2020 06:35:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D7A3F8D0012; Mon, 7 Dec 2020 06:35:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id C2C6B8D0001 for ; Mon, 7 Dec 2020 06:35:46 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 958BE8249980 for ; Mon, 7 Dec 2020 11:35:46 +0000 (UTC) X-FDA: 77566281492.05.anger95_5900a7c273de Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 7C78E18014A32 for ; Mon, 7 Dec 2020 11:35:46 +0000 (UTC) X-HE-Tag: anger95_5900a7c273de X-Filterd-Recvd-Size: 6108 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Mon, 7 Dec 2020 11:35:46 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id e2so317828pgi.5 for ; Mon, 07 Dec 2020 03:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8dMrBUV0z9hLgybDV1qAgRrexcK6XcuJtlWOIrJYhH0=; b=QSXG0JhfnoAGvVBFx63sba2FOkjDtHFQBx/E4eY2XASWrdpLT0Ew5Lxo9DejGl9h++ 5V2/EM/2abVeCbQe6r6uVAcXu38nGBRW5kLnKtZtrVY4TlxWPSKHSY/zlUjObVbTs+wL x9eXcsTw9I5f8s7ws9VtyPX5JLLnZOlJuXOxZXXyCPUjoqPY9XoS104KOPsvqi2TP9Qr dlnqXrw19GS6AKRnSVxl8hUOIkMKM9yyU4zUfq/dJvLXMP8hln1Ay82xzQkUBHKSwNDx ejDThi/5DYZ0I6J/39QFbRF3Y/8kvDD3Eiy1+tKCQcQLGzMn2NiZ6exaemi55aBwIr5D oy1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8dMrBUV0z9hLgybDV1qAgRrexcK6XcuJtlWOIrJYhH0=; b=k5koD0QHr1KtfB0PP345BQrU3St8paqBmcMbJ8jwevgNsUKAowy1PxvhzfzZK2ecB4 hUXhjfDOrK9LJK3EHaq1x6Y6S5asZ9GJsIMovPvAbqJKCWEFWwzvh+eBIQ1XfQwAT5AL 5Lb0RIyNcgFoe25LN7i+bbHlhagaohL4w7mSGXpNfTSHTXJQwrIiQA3KgzSTSpmcHvL8 dCv9GAXwVxTtQ2gYIjVtc52b+zpysHS8XQx4dWQh0tT2CXtMx99oDDJDlYnPyniw4ouZ z/OjrwpgJsacQX15SE8zo0AZugBDt9RXxPaSMjiu7diV9Iq296tQ2hNwLHEGDi1hFub0 HAhw== X-Gm-Message-State: AOAM532Qxx5w3ZvinUWWgmQwY0mZK8Aem3CHBp+UxEsbG9m65f130lnQ +b7GBSvDqommAvzmh1HkPqIslsxVNp4= X-Google-Smtp-Source: ABdhPJxr+/fznfTo2BDgJytsbTQDDtDhOhsgkc3XiXicQdpt2zupWpmvamPhl7LZ72PAGPtdf/AUSg== X-Received: by 2002:a05:6a00:7c5:b029:19e:2965:7a6 with SMTP id n5-20020a056a0007c5b029019e296507a6mr2120711pfu.60.1607340945089; Mon, 07 Dec 2020 03:35:45 -0800 (PST) Received: from localhost.localdomain ([203.205.141.39]) by smtp.gmail.com with ESMTPSA id d4sm14219822pfo.127.2020.12.07.03.35.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Dec 2020 03:35:44 -0800 (PST) From: yulei.kernel@gmail.com X-Google-Original-From: yuleixzhang@tencent.com To: 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, rdunlap@infradead.org, sean.j.christopherson@intel.com, xiaoguangrong.eric@gmail.com, kernellwp@gmail.com, lihaiwei.kernel@gmail.com, Yulei Zhang Subject: [RFC V2 37/37] Add documentation for dmemfs Date: Mon, 7 Dec 2020 19:31:30 +0800 Message-Id: <6a3a71f75dad1fa440677fc1bcdc170f178be1d8.1607332046.git.yuleixzhang@tencent.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: 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/filesys= tems/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 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +The Direct Memory Filesystem - DMEMFS +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + + +.. Table of contents + + - Overview + - Compilation + - Usage + +Overview +=3D=3D=3D=3D=3D=3D=3D=3D + +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, +especially for guest virtual machines. + +It uses a kernel boot parameter ``dmem=3D`` to reserve the system +memory when the host system boots up, the details can be checked +in /Documentation/admin-guide/kernel-parameters.txt. + +Compilation +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +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 + + +Additionally, the following can be turned on to aid debugging:: + + CONFIG_DMEM_DEBUG_FS - Enable debug information for dmem + +Usage +=3D=3D=3D=3D=3D=3D=3D=3D + +Dmemfs supports mapping ``4K``, ``2M`` and ``1G`` size of pages to +the userspace, for example :: + + # mount -t dmemfs none -o pagesize=3D4K /mnt/ + +The it can create the backing storage with 4G size :: + + # truncate /mnt/dmemfs-uuid --size 4G + +To use as backing storage for virtual machine starts with qemu, just nee= d +to specify the memory-backed-file in the qemu command line like this :: + + # -object memory-backend-file,id=3Dram-node0,mem-path=3D/mnt/dmemfs-= uuid \ + share=3Dyes,size=3D4G,host-nodes=3D0,policy=3Dpreferred -numa no= de,nodeid=3D0,memdev=3Dram-node0 + diff --git a/Documentation/filesystems/index.rst b/Documentation/filesyst= ems/index.rst index 98f59a8..23e944b 100644 --- a/Documentation/filesystems/index.rst +++ b/Documentation/filesystems/index.rst @@ -120,3 +120,4 @@ Documentation for filesystem implementations. xfs-delayed-logging-design xfs-self-describing-metadata zonefs + dmemfs --=20 1.8.3.1