Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1329540ybl; Tue, 13 Aug 2019 10:43:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLNqDEl4nt984IXOKAzN7VUSCv5aNgUFl8KAGz9kq7q+QTvQUhnRl3gZumH5obBEpirxVG X-Received: by 2002:aa7:8dcc:: with SMTP id j12mr42334434pfr.137.1565718238532; Tue, 13 Aug 2019 10:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565718238; cv=none; d=google.com; s=arc-20160816; b=fOSYiwyntkihNQZZE1H3KMVooDQV6h7YfO5+mMCXulKqUFEBAni/Hb0M5O9OqB6GL9 81wMrJlVtQJBgS6xvOwYfbYMC5nJggomOcuvWhJTDRjp5g1tY2CrvvTDrGigwcAVHYNp hciG7F/SUfCBvH46fAki0gJ3BcVdcs2VMQazbAx3d6Nk7Vzk3+fiIJz0YEywzZw1qWQ7 +Ycfhycd0fJgMG73fz9MiVOwAV8KjxJCdPgWHW88ZPcY18xLaaSzw1y64Wwy28y+FWvx 4cmY7kawF+Jnj/YsxqIj10s2ihyuZvHMLtQFia7hTtPXhF0K1W0BosoYQBbHp/lzyQA/ 19Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=kx0Evf6I1NobHItu/+QBq5KH/vtVUBboVIuNRABbUQ0=; b=d7qpN02z+npPm/bIH1EP1w0Qp9dCxo1k4ZSPXfLpKMgLW4OiOoJ8T1z3HIKLjguJvu HI9JBVwPCjrCbb9vXPdC0qD3q/ZwSiOkkT8XqI5/1bJ0olD+L61APka7wUyvEBf+TaDr hhyaSzpWKRSnz414R55kkwHNtfGUVmnbC9eGUj2duRIXOtrCjYJnlEM2yCWFeiAsj03x 5O303oV+S5Xn7wZNRblhNf9i8znhMgDhUaarHCxRsrY+0BR2s3jIlYhMf573zn7Es0ZU W4RXNzC180BUwGSxOHM11Mi++24ehTs99fcZ7lMjq9JpphoG8xilqvv6j14DmJtSdpQ0 s9sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si66455180pfb.206.2019.08.13.10.43.42; Tue, 13 Aug 2019 10:43:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727987AbfHMRmY (ORCPT + 99 others); Tue, 13 Aug 2019 13:42:24 -0400 Received: from smtp8.emailarray.com ([65.39.216.67]:29414 "EHLO smtp8.emailarray.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727679AbfHMRmY (ORCPT ); Tue, 13 Aug 2019 13:42:24 -0400 Received: (qmail 31791 invoked by uid 89); 13 Aug 2019 17:42:23 -0000 Received: from unknown (HELO ?172.20.41.143?) (amxlbW9uQGZsdWdzdmFtcC5jb21AMTk5LjIwMS42NC4xMzc=) (POLARISLOCAL) by smtp8.emailarray.com with (AES256-GCM-SHA384 encrypted) SMTP; 13 Aug 2019 17:42:23 -0000 From: "Jonathan Lemon" To: "Ivan Khoronzhuk" Cc: magnus.karlsson@intel.com, bjorn.topel@intel.com, davem@davemloft.net, hawk@kernel.org, john.fastabend@gmail.com, jakub.kicinski@netronome.com, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org, xdp-newbies@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next 2/3] xdp: xdp_umem: replace kmap on vmap for umem map Date: Tue, 13 Aug 2019 10:42:18 -0700 X-Mailer: MailMate (1.12.5r5635) Message-ID: <9F98648A-8654-4767-97B5-CF4BC939393C@flugsvamp.com> In-Reply-To: <20190813102318.5521-3-ivan.khoronzhuk@linaro.org> References: <20190813102318.5521-1-ivan.khoronzhuk@linaro.org> <20190813102318.5521-3-ivan.khoronzhuk@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13 Aug 2019, at 3:23, Ivan Khoronzhuk wrote: > For 64-bit there is no reason to use vmap/vunmap, so use page_address > as it was initially. For 32 bits, in some apps, like in samples > xdpsock_user.c when number of pgs in use is quite big, the kmap > memory can be not enough, despite on this, kmap looks like is > deprecated in such cases as it can block and should be used rather > for dynamic mm. > > Signed-off-by: Ivan Khoronzhuk Seems a bit overkill - if not high memory, kmap() falls back to just page_address(), unlike vmap(). -- Jonathan > --- > net/xdp/xdp_umem.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c > index a0607969f8c0..907c9019fe21 100644 > --- a/net/xdp/xdp_umem.c > +++ b/net/xdp/xdp_umem.c > @@ -14,7 +14,7 @@ > #include > #include > #include > -#include > +#include > > #include "xdp_umem.h" > #include "xsk_queue.h" > @@ -167,10 +167,12 @@ void xdp_umem_clear_dev(struct xdp_umem *umem) > > static void xdp_umem_unmap_pages(struct xdp_umem *umem) > { > +#if BITS_PER_LONG == 32 > unsigned int i; > > for (i = 0; i < umem->npgs; i++) > - kunmap(umem->pgs[i]); > + vunmap(umem->pages[i].addr); > +#endif > } > > static void xdp_umem_unpin_pages(struct xdp_umem *umem) > @@ -378,8 +380,14 @@ static int xdp_umem_reg(struct xdp_umem *umem, > struct xdp_umem_reg *mr) > goto out_account; > } > > - for (i = 0; i < umem->npgs; i++) > - umem->pages[i].addr = kmap(umem->pgs[i]); > + for (i = 0; i < umem->npgs; i++) { > +#if BITS_PER_LONG == 32 > + umem->pages[i].addr = vmap(&umem->pgs[i], 1, VM_MAP, > + PAGE_KERNEL); > +#else > + umem->pages[i].addr = page_address(umem->pgs[i]); > +#endif > + } > > return 0; > > -- > 2.17.1