public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC rdma-core 1/2] Registering non-contiguous memory
@ 2018-01-04 17:47 Alex Margolin
       [not found] ` <1515088046-26605-1-git-send-email-alexma-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Alex Margolin @ 2018-01-04 17:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Alex Margolin

Numerous applications communicate buffers with a non-contiguous memory layout.
For example, HPC applications often work on a matrix, and require sending a row or a column: 

```
               M
          -----------
         | |X| | | | |
          -----------
         | |X| | | | |
          -----------   N
         | |X| | | | |
          -----------
         | |X| | | | |
          -----------
```

There are two alternatives to send the cells marked with an 'X' using contiguous buffers:

1. Create a list of N scatter-gather entries, each with the length of a single cell, and pass those inside an ibv_send_wr to ibv_post_send().
2. Create a temporary contiguous buffer to hold all N marked cells, copy each cell to it's respective location in this buffer and pass this buffer to ibv_post_send().

Both alternatives requires additional memory resources, linear with respect to N, in order to send the desired memory layout. Non-contiguous memory registration addresses this issue - to allow passing a compact description of a memory layout for send/recv operations. In this example, the registered memory description would include the base pointer to the first cell, the matrix dimensions (M and N) and the size of a single cell.
Another use-case for non-contiguous memory access is when more than one memory region holds the data and the request may span across multiple MRs:

```
                     ----------
                    |          |
                    |          |
                    | Memory   |
                   /| region #1|
     "Composite   / |          |
       region"   /  |          |
     ---------- /  -|          |
    |          |  / |          |
    |          | /   ----------
     ---------- <
    |          | \   ---------- 
    |          |  --|          |
    |          |    | Memory   |
    |          | ___| region #2|
     ---------- <   |          |
    |          | \   ----------
     ----------\  \_ ----------
                \   |          |
                 \  | Memory   |
                  \-| region #N|
                    |          |
                    |          |
                     ----------
```

Similarly, sending such a layout would require specifying all N memory keys in every ibv_post_send() invocation, while the alternative could be listing those once in advance, and each operation only includes a base pointer and length.

The key for dealing with non-contiguous memory layouts at a low latency is the ability to describe it in the data path. This means the API has to allow user-level registration of such layouts. For this end, this API is an extension to the Memory Regions API, where the user can dynamically assign non-contiguous layout description to an MR.


Alex Margolin (1):
  verbs: Introduce non-contiguous memory registration

 libibverbs/man/ibv_rereg_mr.3             |   2 +
 libibverbs/man/ibv_rereg_mr_interleaved.3 | 260 ++++++++++++++++++++++++++++++
 libibverbs/man/ibv_rereg_mr_sg.3          | 181 +++++++++++++++++++++
 libibverbs/verbs.h                        |  75 ++++++++-
 4 files changed, 517 insertions(+), 1 deletion(-)
 create mode 100644 libibverbs/man/ibv_rereg_mr_interleaved.3
 create mode 100644 libibverbs/man/ibv_rereg_mr_sg.3

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-02-01 18:45 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04 17:47 [RFC rdma-core 1/2] Registering non-contiguous memory Alex Margolin
     [not found] ` <1515088046-26605-1-git-send-email-alexma-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-04 17:47   ` [RFC rdma-core 2/2] verbs: Introduce non-contiguous memory registration Alex Margolin
     [not found]     ` <1515088046-26605-2-git-send-email-alexma-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-11 12:22       ` Yuval Shaia
2018-01-11 16:44         ` Jason Gunthorpe
     [not found]           ` <20180111164455.GA1309-uk2M96/98Pc@public.gmane.org>
2018-01-22 15:59             ` Alex Margolin
     [not found]               ` <VI1PR05MB1278C4C4FF78B4B1A551252EB9EC0-79XLn2atqDMOK6E67s+DINqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-01-23 20:29                 ` Yuval Shaia
2018-01-25 12:43                   ` Alex Margolin
     [not found]                     ` <VI1PR05MB12787572593F02F05AA20DE1B9E10-79XLn2atqDMOK6E67s+DINqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-01-25 16:07                       ` Jason Gunthorpe
2018-01-28 20:37                       ` Yuval Shaia
2018-01-29 17:27                         ` Jason Gunthorpe
     [not found]                           ` <20180129172717.GW23852-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-30 11:35                             ` Marcel Apfelbaum
     [not found]                               ` <12d04e1b-6024-0763-f5c5-46ca8b0823a6-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-01-30 15:42                                 ` Jason Gunthorpe
     [not found]                                   ` <20180130154200.GD21679-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-31 12:27                                     ` Marcel Apfelbaum
     [not found]                                       ` <76b5a8cf-b3ed-c76d-6157-91fc5f6f2b35-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-01-31 18:38                                         ` Jason Gunthorpe
     [not found]                                           ` <20180131183810.GA23352-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-02-01 18:22                                             ` Marcel Apfelbaum
     [not found]                                               ` <dded9055-a329-9b9d-943a-7a60445e2ada-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-02-01 18:29                                                 ` Jason Gunthorpe
     [not found]                                                   ` <20180201182959.GN23352-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-02-01 18:45                                                     ` Marcel Apfelbaum
2018-01-25 13:10                   ` Alex Margolin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox