Received: by 10.223.185.116 with SMTP id b49csp539874wrg; Fri, 16 Feb 2018 03:14:13 -0800 (PST) X-Google-Smtp-Source: AH8x226WiXS+aVwpHHQjFJ4GAtxAefJ8g6roHLhJQiU4BI/nHtzHfhNv0V+86wojciTkjTrLUnQL X-Received: by 10.101.72.199 with SMTP id o7mr4874510pgs.303.1518779653396; Fri, 16 Feb 2018 03:14:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518779653; cv=none; d=google.com; s=arc-20160816; b=zMMxDn28TvzaHmB0jg5C/50rI/98EQmxd7I79DAtPbYoIhEdNmBQo+DkJQwGAjflh+ m0NDTf9MnQGmKMDnftRbjDdaURsFUlMYVLZy3talJujfX5JI72ZApnbMrfn1XRyOdJys CX84yMOBx3UP7cpNkxKPlQU8taWBV8lMiYcyzyPwGm0ZHlpsErlsx6mOqMNhYODjbUXv MU4+pDH2rWqQPIMUyCKgjtL49AOZ0R17Lg3xqJe+daqDJ+jWTQFRg7rqILmRfvQk6VSY 1/3Zx4rlzflYVo4G/AAg78an2XlmsjQRVSS1Ju7lNXKdvgNpY/HxKa3pRyP/QvhDVUxz 469g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=zERc1a22tSDF3nVXbRSHsy9ApKOHrDKjm8rTnvZcidQ=; b=LXxtrV3CBy/Jh3T/0B3Bd4v8CUqFW8PmR70mxjDW9DjKb41xY7SnDm5yd5WNDaG5J/ AcjvAwCqrzHBYfwi5nn7rk+wmcyazzvvS3e10yPlHR4/uqXlUNWv0BQ+4GSANl7ftA5h l1y8nzW2Z+6LcygsS99VO5V2VsLY1y/hWEloLcAGaDxXoxfnA0PIzJ5yUvcyUHKrIKB0 AoZdc/HtvbacvtMbH5oRRBlYobt4+68OHMgEVHpUzfvXHLJbwRNL8HkIvtbIQxBs+Ch/ c+cUDMPxjsTFPEjn0VEsW9BywoOOkijZcp8pZR6+2lVukrmRk+J+DYWgRrEGhVBbPVpo OsYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MpVEZYRj; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si2813394pfm.409.2018.02.16.03.13.58; Fri, 16 Feb 2018 03:14:13 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MpVEZYRj; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946101AbeBORnP (ORCPT + 99 others); Thu, 15 Feb 2018 12:43:15 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35215 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946084AbeBORnK (ORCPT ); Thu, 15 Feb 2018 12:43:10 -0500 Received: by mail-pg0-f66.google.com with SMTP id l131so325270pga.2; Thu, 15 Feb 2018 09:43:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=zERc1a22tSDF3nVXbRSHsy9ApKOHrDKjm8rTnvZcidQ=; b=MpVEZYRjfele0rE0dxz5wEpkeMDju0beAQTxJhDa/MpAtmEIG1eVS4N9OwHUoHr41P 9JW61PL+An+f8Skl66aqAdOmOiDi9U7KN72XjoJgwUOka9jDEvN4d0gcj1DWr6t/IwEU xpd738MB/0pUvUbtfuf9f1UKIeE2sHUV43DSP/V3TCUlrKgkVTz9DYCkXGGLNzOkz7mI AtKlD28nHgMktn1VEt6Iq3pWiaeJFaOpgKakuikG3HyLSk4wbghjeE6/klQsrGvOxQhc Q479ip3u9MS8yv+niD2dJDb1/2CS+J1Jxmn6E9T72wlK4FijfjVVUGIWvRcZkAp1zKUo XJNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=zERc1a22tSDF3nVXbRSHsy9ApKOHrDKjm8rTnvZcidQ=; b=o2kETnLuL/MNiR/5i/rvnbjG+KDePvVuGXkWKsIZYoEIG66OBm9tFzV0XyQiFY1upA fEQ4mvGvDbJHiJw8WD/WvHFlu6cxm4eCbpiWhvLSk5uOKWYZ3liEQv28iL2PrXM8b/bV MyTLcAMcFOTpyKke/1i35Qdq+psYLN1wVT/pHRZAKWMebi+4wQAnlGC8IXsVySWzf6VH lCKWYGewrdasRcI7nPFkMwX9M4wIkoPvj/Oeym/1htrI4Kw6rT0blFizpDLF0OgkstX8 U/l2MzF3J7r5ry3mPJKdvXJUj0+VEdt75Jv+HaVvKptb6SqDrs9umckkZN8TzahHDMuY /OJQ== X-Gm-Message-State: APf1xPAFgnDw17NN58OH/6DhG8N7IHCZM9xrcdB2ASCDLIZKHibYyfzy eWeCJDYIcWgIayDS0X+AjSM= X-Received: by 10.98.185.24 with SMTP id z24mr3344924pfe.185.1518716589398; Thu, 15 Feb 2018 09:43:09 -0800 (PST) Received: from ?IPv6:2620:15c:2c1:200:e081:603e:7fdc:75e? ([2620:15c:2c1:200:e081:603e:7fdc:75e]) by smtp.googlemail.com with ESMTPSA id y1sm36710271pge.78.2018.02.15.09.43.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2018 09:43:08 -0800 (PST) Message-ID: <1518716586.3715.205.camel@gmail.com> Subject: Re: v4.16-rc1 misaligned atomics in skb__clone / __napi_alloc_skb From: Eric Dumazet To: Eric Dumazet , Mark Rutland Cc: netdev , LKML , David Miller , Willem de Bruijn Date: Thu, 15 Feb 2018 09:43:06 -0800 In-Reply-To: References: <20180215170432.e4wue4osyv3vmdla@lakrids.cambridge.arm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-02-15 at 09:24 -0800, Eric Dumazet wrote: > > I will send something more suited to original intent of these commits : > > 90e33d45940793def6f773b2d528e9f3c84ffdc7 tun: enable napi_gro_frags() > for TUN/TAP driver > 943170998b200190f99d3fe7e771437e2c51f319 tun: enable NAPI for TUN/TAP driver Can you try this patch ? Thanks !  drivers/net/tun.c |   16 ++++++----------  1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 81e6cc951e7fc7c983919365c34842c34bcaedcf..b52258c327d2e1d7c7476de345e49f082909c246 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1489,27 +1489,23 @@ static struct sk_buff *tun_napi_alloc_frags(struct tun_file *tfile, skb->truesize += skb->data_len; for (i = 1; i < it->nr_segs; i++) { + struct page_frag *pfrag = ¤t->task_frag; size_t fragsz = it->iov[i].iov_len; - unsigned long offset; - struct page *page; - void *data; if (fragsz == 0 || fragsz > PAGE_SIZE) { err = -EINVAL; goto free; } - local_bh_disable(); - data = napi_alloc_frag(fragsz); - local_bh_enable(); - if (!data) { + if (!skb_page_frag_refill(fragsz, pfrag, GFP_KERNEL)) { err = -ENOMEM; goto free; } - page = virt_to_head_page(data); - offset = data - page_address(page); - skb_fill_page_desc(skb, i - 1, page, offset, fragsz); + skb_fill_page_desc(skb, i - 1, pfrag->page, + pfrag->offset, fragsz); + page_ref_inc(pfrag->page); + pfrag->offset += fragsz; } return skb;