Content-Type: multipart/mixed; boundary="===============5290597314204102008==" MIME-Version: 1.0 From: Harris, James R Subject: Re: [SPDK] Memory Buffer Allocation in SPDK Date: Tue, 13 Dec 2016 04:46:59 +0000 Message-ID: <6EE29130-9ABD-4825-89D1-77DEBEFDC162@intel.com> In-Reply-To: 01acc08b07afdca4b70a587cc00c99dd@cs.fsu.edu List-ID: To: spdk@lists.01.org --===============5290597314204102008== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable > On Dec 12, 2016, at 9:13 PM, yzhu wrote: > = > Hi All, > = > Is there any way to directly use the memory allocated by the malloc() fun= ction? The spdk_malloc() allocates a pinned memory buffer in huge page, and= the spdk_nvme_ns_cmd_write also uses the pinned memory for write. However,= if we allocate a memory buffer by malloc(), how could we directly write da= ta to NVMe device by SPDK without copying data to the buffer allocated by s= pdk_malloc()? > = Hi Yue, There is no safe way to use a malloc() buffer for DMA, since the buffer cou= ld be swapped out at any time. mlock() can be used to ensure the buffer st= ays present in RAM, but it does not guarantee the buffer will not get migra= ted to a different physical location. mlock() also has a lot of software o= verhead and is not something you would want to call for every I/O. -Jim --===============5290597314204102008==--