Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp336810imj; Sat, 16 Feb 2019 01:17:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IZysbXf6PkYvglOmuXyqe5VWEWs/PN0cOGgkCD7QynaKHCbpSBM5Ttt1sIIpH9o2AvNdwhM X-Received: by 2002:a62:5789:: with SMTP id i9mr13737813pfj.75.1550308660070; Sat, 16 Feb 2019 01:17:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550308660; cv=none; d=google.com; s=arc-20160816; b=cVILEo5YBDhVOffX8c+J0Q78ajQrPT7LvQcTJlfFW6gmgb7x6RHUJz0Opyg+ja6YwV PrjU0WWwC9oWmM2LLWFY+5S4gzIMLz3AyfLXQk770hH/NLCr8J/8tErBgeecS1N9qeA1 TgzVWP06LL5zhwo/xmgjFdOpWYBXZBz5vnnbUUGd7OMdcBkaCAzera5QSIP2EQikedAA 3jfJmk3yqkZeflJGvgxdVwMwo2MGamv+sN9DMa6Xsg0q5p160IW8TT2U7YB8/+RPeR0M I8JRS4+xIrRc+N3a0PJNwuS6j2OpuP9RzjE/Nb7s5JrnZDx1tDXDrw2NCjEpMcWkC036 9R8A== 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 :user-agent:message-id:date:cc:to:from:subject:dkim-signature; bh=HBcjk503nQuKRSQt+/RVqHzYhBzzBuRiWKFD+cpVj7Q=; b=rjmuIlOPSMLz6O4eqEXi3C/KafgrxWH1JSyKfiX/b/tey8VTuP5ee2rqs+jYv7kzYj cXj2BkKS1clA9id+mIj+gNNDpVcfD2KXRGFaGZjrcqT4F+ZaLLVE9piAJYi6nl7lBKhC 3IfrF3Xh6Oc7i91gAiscHS8BLbyN2Amn8i/vTtPXkvdIjPIWGExutI99RoDCMn7LtjC6 VaiJsfOQm+cN/c3ZQC0eKz5WkGJMt/Hjmqz57DgMyW7vhGDpTIZW2nNnlQCa0YCpWN1l +uEHz3hSFCAe9YPtavFDSL7XoMaXvwXA0dKp+mfb6/1Qyxo/surjC722QYWbPA1sNsDl G9pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ij/nOVUE"; 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 j11si8265635plb.253.2019.02.16.01.17.24; Sat, 16 Feb 2019 01:17:40 -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="ij/nOVUE"; 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 S2404481AbfBOWoJ (ORCPT + 99 others); Fri, 15 Feb 2019 17:44:09 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44150 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727752AbfBOWoI (ORCPT ); Fri, 15 Feb 2019 17:44:08 -0500 Received: by mail-pf1-f196.google.com with SMTP id u6so5486844pfh.11; Fri, 15 Feb 2019 14:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=HBcjk503nQuKRSQt+/RVqHzYhBzzBuRiWKFD+cpVj7Q=; b=ij/nOVUEwkqqrwG9/VWRIis6Tn4jNei6jZnSUTGb91GMP0U/r/K8Dycz1T3SfKPx/L CAxjFNMxhYSCK7Ukh+OrQwX59qnpkizgpA+rppiFktl97+Kj/WZrct5+j6B79lnn8dVc tutGGEsYmFN2i3vgw5CoxxOWJs7AJJnkDypzejhCKmECyoqMQdpGRPpMUD9YI3z8rtGl C1vaIFfA9V2+NUPUOGZNGZolJHWZf8JEljC4dgydcXJ40su5OF0jzBV7Nkj61R8folS5 V+17nKS+51lgVdoPC0Trl5KFvaqroM3WDA1CjqehtxYBeyeD0vv1Xb2Y9/3gvzmj2UDt UcUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=HBcjk503nQuKRSQt+/RVqHzYhBzzBuRiWKFD+cpVj7Q=; b=WlXDwuAhYhbMPnvBxaXdHBLz4Edlg9bON5dDtd8oMS8ZN5JJppmGlnf4GPGnudDoD7 bUX4Wea/F/wsNCLNe2xBX510Pilpb7dCcGhcPNHc1XBqiZmR0XC5uhcXOOqnmtheH8SQ wol5IiDcytXn7WW3vhK8D2u0BGf4N8be5HpwySqTXNVIN/nFGeM1PH3GrK4c0TNmxt+p Dk+F3xbxUqDbTwHX5Ax7YE0xONech05Wmy+IIukBuscjqb/jQqXf4tXK9MEiP52EeMDc eCCoVW7niWwinLMyw2BhsdGTnz6UlvS9fIviQ2LQs5/bdPjedZB/GnrW46SPr32xHKID 8EyQ== X-Gm-Message-State: AHQUAuYOGylklylbWmCEP/fANYoWS9l/+f32+W6cioE/Dc2VubnK+jVw 1h4Rt3gEYESUoIMQiYx03+ffHe90 X-Received: by 2002:a62:5687:: with SMTP id h7mr12072726pfj.198.1550270647308; Fri, 15 Feb 2019 14:44:07 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id y21sm11474272pfi.150.2019.02.15.14.44.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Feb 2019 14:44:06 -0800 (PST) Subject: [net PATCH 0/2] Address recent issues found in netdev page_frag_alloc usage From: Alexander Duyck To: netdev@vger.kernel.org, davem@davemloft.net Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, jannh@google.com Date: Fri, 15 Feb 2019 14:44:05 -0800 Message-ID: <20190215223741.16881.84864.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set addresses a couple of issues that I had pointed out to Jann Horn in response to a recent patch submission. The first issue is that I wanted to avoid the need to read/modify/write the size value in order to generate the value for pagecnt_bias. Instead we can just use a fixed constant which reduces the need for memory read operations and the overall number of instructions to update the pagecnt bias values. The other, and more important issue is, that apparently we were letting tun access the napi_alloc_cache indirectly through netdev_alloc_frag and as a result letting it create unaligned accesses via unaligned allocations. In order to prevent this I have added a call to SKB_DATA_ALIGN for the fragsz field so that we will keep the offset in the napi_alloc_cache SMP_CACHE_BYTES aligned. --- Alexander Duyck (2): mm: Use fixed constant in page_frag_alloc instead of size + 1 net: Do not allocate page fragments that are not skb aligned mm/page_alloc.c | 8 ++++---- net/core/skbuff.c | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) --