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=-6.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 34A41C433E1 for ; Sun, 23 Aug 2020 13:08:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CE2242075B for ; Sun, 23 Aug 2020 13:08:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iHLakyFh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE2242075B 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 266056B0002; Sun, 23 Aug 2020 09:08:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 216196B0003; Sun, 23 Aug 2020 09:08:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 107426B0005; Sun, 23 Aug 2020 09:08:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id EC05D6B0002 for ; Sun, 23 Aug 2020 09:08:31 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A97CB8248068 for ; Sun, 23 Aug 2020 13:08:31 +0000 (UTC) X-FDA: 77181862422.02.soap98_1f0e4b72704a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 7815A10097AA0 for ; Sun, 23 Aug 2020 13:08:31 +0000 (UTC) X-HE-Tag: soap98_1f0e4b72704a X-Filterd-Recvd-Size: 5342 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Sun, 23 Aug 2020 13:08:31 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id 2so2817794pjx.5 for ; Sun, 23 Aug 2020 06:08:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=CccyAgQ0dfzSvBms9PIvPOVtqSydW1/UzHohgvEARK8=; b=iHLakyFhdWIeR7qe035odPB2R+Ke7oSjDbMH2wOP8fES4KkmJFYIHkbkTZNCDvAHGe S3ItdY/Jp9c5n8QRqB2KgiPN5VvXevrYd7zopkU+ZVxjbk7DP8xdvbde2EdYnQ/UzyIU s3iO760/T4SuY12fQiG7+1LNWzepFQ0pAsmlTvN0cAfqgoCkBNOOZaH8DJMYD88Krc/7 dgUeJncQ0Yd7oVN2zbyNLnnihIc06BKNg+wFMI5ooYWQAKeLRU9maMskkOpwkY2Qi6BX i//AVUhVxr2FjKJdtr1ilgZNDBl+KgDw1XhSHr44/58Mk/OWd+RBxULTC5XxOP2uVvAI 54mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CccyAgQ0dfzSvBms9PIvPOVtqSydW1/UzHohgvEARK8=; b=cjsUWaLEw/aOOepKb4FF5jTJUgrfxcsRyq6C1ssQfTrrD8HSgoYSNsfDLDrnA2raCm jgWsfnKpTbHJOssjsXZssAmqI5aAPANSUUFqLv+vXJVS70TSX6ivR+PnTB0NiTQfS/8f ARbAbiXCVPEtc61ch8+45SAecDWvyee6ThgYY8NmPCggV+J8N682ua05Uq2pOlf41HWm x89zJgKdAhcyCBtdlyUr7s0G6AcdA1CcttNGiUcJTy9w9xncv2wBg4Tbj4alFVxHKGmQ NDWPvw4q2RZepStyDeU5oLW2IDrbLdruIt6WiwqDE0PjcXEiY7p+An9yS3s6piHJr5RL N1IA== X-Gm-Message-State: AOAM533r2jI3eQIBFVLD4ZCZ1CtP2gXiWSZSNh39MWpzwxclzz1+Bmu1 z0aqijShQNbnMTj8wVRZuEI= X-Google-Smtp-Source: ABdhPJzrlhUMKUH+9GIRxc68/tWTHv+WXy9Ac5h0R/+/2qQq7qCVessoo9NhMQfPZxL27hexqJFhjg== X-Received: by 2002:a17:90b:124e:: with SMTP id gx14mr1044431pjb.225.1598188110125; Sun, 23 Aug 2020 06:08:30 -0700 (PDT) Received: from [192.168.1.7] ([1.23.2.212]) by smtp.gmail.com with ESMTPSA id z6sm8252554pfg.68.2020.08.23.06.08.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 23 Aug 2020 06:08:29 -0700 (PDT) Subject: Re: Regarding HMM To: Ralph Campbell , linux-mm@kvack.org Cc: jglisse@redhat.com References: <3482c2c7-6827-77f7-a581-69af8adc73c3@nvidia.com> From: Valmiki Message-ID: <6b768b7d-e754-ebea-8467-005c38db6dd9@gmail.com> Date: Sun, 23 Aug 2020 18:38:16 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <3482c2c7-6827-77f7-a581-69af8adc73c3@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 7815A10097AA0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 18-08-2020 10:36 pm, Ralph Campbell wrote: > > On 8/18/20 12:15 AM, Valmiki wrote: >> Hi All, >> >> Im trying to understand heterogeneous memory management, i have >> following doubts. >> >> If HMM is being used we dont have to use DMA controller on device for >> memory transfers ? >> Without DMA if software is managing page faults and migrations, will >> there be any performance impacts ? >> >> Is HMM targeted for any specific use cases where DMA controller is not >> there on device ? >> >> Regards, >> Valmiki >> > > There are two APIs that are part of "HMM" and are independent of each > other. > > hmm_range_fault() is for getting the physical address of a system > resident memory page that > a device can map but is not pinned in the usual way I/O increases the > page reference count > to pin the page. The device driver has to handle invalidation callbacks > to remove the device > mapping. This lets the device access the page without moving it. > > migrate_vma_setup(), migrate_vma_pages(), and migrate_vma_finalize() are > used by the device > driver to migrate data to device private memory. After migration, the > system memory is freed > and the CPU page table holds an invalid PTE that points to the device > private struct page > (similar to a swap PTE). If the CPU process faults on that address, > there is a callback > to the driver to migrate it back to system memory. This is where device > DMA engines can > be used to copy data to/from system memory and device private memory. > > The use case for the above is to be able to run code such as OpenCL on > GPUs and CPUs using > the same virtual addresses without having to call special memory > allocators. > In other words, just use mmap() and malloc() and not clSVMAlloc(). > > There is a performance consideration here. If the GPU accesses the data > over PCIe to > system memory, there is much less bandwidth than accessing local GPU > memory. If the > data is to be accessed/used many times, it can be more efficient to > migrate the data > to local GPU memory. If the data is only accessed a few times, then it > is probably > more efficient to map system memory. Thanks Ralph for the clarification.