Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8672437ybn; Tue, 1 Oct 2019 11:25:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhiZdyLRwAol6Rl92SuYeXUcFigQ6BuwoVlpAA3GqcHpPdOnJFA00dDhFyntYFCj9g8z8Z X-Received: by 2002:a05:6402:1251:: with SMTP id l17mr27370286edw.270.1569954354773; Tue, 01 Oct 2019 11:25:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569954354; cv=none; d=google.com; s=arc-20160816; b=ZKkGtZHQq3dUDBKmbKrz762F365mxiiMEcLBpIPJ65m+4PXTrFZuaQjW9XH6gDkfvm XUPRNqc7ZuTfcyI+cPWm8NmMrPgt7LLjuHgWCA2HYRfxnS+oO6RuIblRBIq0jtDbPiy2 VmfUVD6YiDWLC0mLrSRfxM6UBZaSmD7WRPYN9d+GZ6NjS1fNXF1/WciT8CvF0DKCBOEp OAUNidqf719ifOdJn9y1r5b6l8lv5LeEjYDBIEZxFyoQEYXX3uY5CiCLryaj+VMegtkn ETrwukyqWZMKKSNZ54CqfIhwxSuynWLYRHFmeC2YqMT0Lt4ZUpxbS6XdlgyQqT6/qfBS o9TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xsb8X67G1dgu/8EsNnROg1igCsh1++gnvS+/mAQM0dU=; b=JfuPrkJPGproca8iF1rf5l4yEkWTuS2eiwmLgt1G4FDy62m6mATiuWsX64xiNdBXYz 3VYIDtxp5lEvQ2rUSeIwHfSpTuazxDnEpeZONHf6bHvW98ycvTjU3oTvpnPVIZQGPTF7 2j8jHyvTgG5oX+tAcfjHzJJ2m/G+WXd1baLrt0No96s2YqinunW/rlwqL0daNAg98nbC CkjDgTKLjnDeCw9XdmD9xl+RTzCowMHGKbYcNskpDxJRkmWTO3sX/Mr//WVppK9t0/8h 0cVcpU9vhmxrEYIU3Ba4TdnqJg6CUsUax4ZAv92BYOjGvsDr6bAB6Hil5lan4ziqihD0 4t0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="V/FIMLaP"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-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 c38si9797923eda.46.2019.10.01.11.25.16; Tue, 01 Oct 2019 11:25:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-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="V/FIMLaP"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-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 S1732178AbfJASYG (ORCPT + 99 others); Tue, 1 Oct 2019 14:24:06 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:43777 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731560AbfJASYG (ORCPT ); Tue, 1 Oct 2019 14:24:06 -0400 Received: by mail-lf1-f68.google.com with SMTP id u3so10661155lfl.10; Tue, 01 Oct 2019 11:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xsb8X67G1dgu/8EsNnROg1igCsh1++gnvS+/mAQM0dU=; b=V/FIMLaPog/lK3+LFmJucz8381bvDo5ayEdKyZgtHCDNw7ntbb/uvHcVtBZ9whSuiN 4NLT7UbPei21ad3LRXwWzQp1+Ax4bwIjb8IDNZtBGspToZ1ebYILzy07ZWKP0qTWpQ4E hQIOrssNVxZdYNTWni+0WECaLpeEPJQ6P9KgJR1A8KhmpXQmJx13HAocjl61fQ6HI9VI oXhV5DFfGXbQqJCQLGQD9YXyA3jeVIqSRNwPytThbz46vGCkQFgkT6CWvjrbNjCiKP7z cm5h0/KOxUg+CPKrlDWuRRX1AVfSMMR0C5fjjnVu5mN7zMvGL9toRQcJm9pQ4zWN7BAF mSUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xsb8X67G1dgu/8EsNnROg1igCsh1++gnvS+/mAQM0dU=; b=BlOhKQdgYYFYw2Ivt600IpdywLZ8Q7krTmEikb78V7aZRRtlrguGmlYxUYqeWkDENz k8/auBALrEkc79fvTSVMgSVYCLMShBXGIOgm+TRsCNZDMFwC80C+6HxwUxRh1bdDlSZ5 J1fesd2o+FwDvU2zFYkvFWL++US4TM+rWAaiRYrRP5n3y2K2NtmP74fOY6wrk9TyvRX2 6/upCse7cPXmfmEDTNS/mQA62vKvcE67yIY4oSsGjc0K/Vroz3i2Kha4Zb2c+SWexlv+ WLxIQmUg2Q8OwaSdDXsSSaiBkKXu8uM/0VORIx8/yB5K7tP96OoQ4BnM6gt1UnzkgAMB SDCw== X-Gm-Message-State: APjAAAU1O4Bk8gbos85/cIKf4KgMx6e1dv3PRF+iRZDZpLQ5qkavJJn9 3ZgjvqYNCbQl2CHsT2SSVtElfJMezwrSWvyKhog= X-Received: by 2002:a19:cc15:: with SMTP id c21mr15571875lfg.64.1569954244189; Tue, 01 Oct 2019 11:24:04 -0700 (PDT) MIME-Version: 1.0 References: <20190928164843.31800-1-ap420073@gmail.com> <20190928164843.31800-2-ap420073@gmail.com> <39e879f59ad3b219901839d1511fc96886bf94fb.camel@sipsolutions.net> <9bbf73e318df17d179014937cb6c1335fb303611.camel@sipsolutions.net> In-Reply-To: <9bbf73e318df17d179014937cb6c1335fb303611.camel@sipsolutions.net> From: Taehee Yoo Date: Wed, 2 Oct 2019 03:23:52 +0900 Message-ID: Subject: Re: [PATCH net v4 01/12] net: core: limit nested device depth To: Johannes Berg Cc: David Miller , Netdev , linux-wireless@vger.kernel.org, Jakub Kicinski , j.vosburgh@gmail.com, vfalico@gmail.com, Andy Gospodarek , =?UTF-8?B?SmnFmcOtIFDDrXJrbw==?= , sd@queasysnail.net, Roopa Prabhu , saeedm@mellanox.com, manishc@marvell.com, rahulv@marvell.com, kys@microsoft.com, haiyangz@microsoft.com, Stephen Hemminger , sashal@kernel.org, hare@suse.de, varun@chelsio.com, ubraun@linux.ibm.com, kgraul@linux.ibm.com, Jay Vosburgh , Cody Schuffelen , bjorn@mork.no Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, 1 Oct 2019 at 22:57, Johannes Berg wrote: > > Hi, > Hi! > (jumping out now, forgive me for being so brief) > > > If I understand correctly, you said about the alignment of > > "lower_level" and "upper_level". > > I thought this place is a fine position for variables as regards the > > alignment and I didn't try to put each variable in different places. > > > > If I misunderstood your mention, please let me know. > > Not sure what you mean, alignment doesn't matter for them (they're u8). > > I was thinking of the packing for the overall struct, we have: > > unsigned int max_mtu; > unsigned short type; > unsigned short hard_header_len; > unsigned char min_header_len; > > + unsigned char upper_level, lower_level; > > unsigned short needed_headroom; > unsigned short needed_tailroom; > > > Previously, there was a one byte hole at that spot due to a single > "unsigned char" (after something aligned at least 4 bytes) followed by > "unsigned short" - now you push that out a bit. > > If you place the variables a bit lower, below "name_assign_type", you > probably fill a hole instead. > > Check out the 'pahole' tool. > Thank you for the detailed explanation. I tested the pahole and found holes. $ pahole ./vmlinux.o -C net_device unsigned char addr_assign_type; /* 598 1 */ unsigned char addr_len; /* 599 1 */ short unsigned int neigh_priv_len; /* 600 2 */ short unsigned int dev_id; /* 602 2 */ short unsigned int dev_port; /* 604 2 */ /* XXX 2 bytes hole, try to pack */ I will place the variables here. > johannes > Thank you so much! Taehee