Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp298212imn; Wed, 27 Jul 2022 06:37:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1utIeo6muZmguTDX3Wu9HutQVsAPAJMzpSM3CxV4BIEvLQKy1N0BO3piQTsmBYQcV6tlMf6 X-Received: by 2002:a17:902:7007:b0:16c:f4d8:51a with SMTP id y7-20020a170902700700b0016cf4d8051amr21410971plk.1.1658929068414; Wed, 27 Jul 2022 06:37:48 -0700 (PDT) Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a17090af8c300b001f1fb8ef790si2020033pjd.22.2022.07.27.06.37.32; Wed, 27 Jul 2022 06:37:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iHd2hhZE; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233234AbiG0M7V (ORCPT + 99 others); Wed, 27 Jul 2022 08:59:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbiG0M7S (ORCPT ); Wed, 27 Jul 2022 08:59:18 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDA843E75A for ; Wed, 27 Jul 2022 05:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658926756; x=1690462756; h=message-id:date:subject:to:cc:references:from: in-reply-to:mime-version; bh=ywWvecl1F74xrTJ9/DG5CEaQQTwZKlCHwjf2vRtFJjM=; b=iHd2hhZE28FFGT293CC+ZRcERqPs5afArK3DyR++Ng7ThyMhrGDuhE5X oZVY9wn1uUeaH+bAnAyoXn+Pdi/+kqjVTiOnKNkA+5BB+RygskP1SZypE bWrixL59pltkHewFuB/dKVR8+hu39TwnUzqE/M2AhgTIh1/OdqfUOTRi4 SFkL53WtvgqmIitZZVuVSfkSkNRJV1nQEPb5lHOEE3n4YbSVddrwlucbW WnweKpHi0FgYLE5tLDdMB7lKI8CW6f0UDrIaaQhiLGFKoidNEZ3Mj4IDu jP0ovbZTR4WDjBAT60IWI/cWOSNRK3WjCIf5K8TQdfrmJZQOLPHpbYni2 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10420"; a="268608569" X-IronPort-AV: E=Sophos;i="5.93,195,1654585200"; d="scan'208";a="268608569" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 05:59:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,195,1654585200"; d="scan'208";a="659187222" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga008.fm.intel.com with ESMTP; 27 Jul 2022 05:59:16 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 27 Jul 2022 05:59:16 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 27 Jul 2022 05:59:15 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Wed, 27 Jul 2022 05:59:15 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.108) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.28; Wed, 27 Jul 2022 05:59:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=boJ1JU2IkccRgmaPIkIkN70vvXrCz66YzJFcY/Pa5F+GltQyaACDicF3Ja1enLnk6cCMohVgKQPCqHCTxCFxLtW5deAeYX6LFlruqClW01ChiMj+ZP4Uq3p666YMQ2VXnfhWUkHXRjPipgsIzg4OOf5oOvGA4syudrcOfrLbsu7O4oE7s8Li242zwwlUyufSOmSPTI7bCQJr1z/0oc5QAAjDQr9pm6HpmgGMIWEBf6qRk1eamHh4DPp8QX07Z7YeHJLhegAFo1hnh4jcJXkLmFQlgSh4adMlz9N7nQwgVecHMrLvLAcRU5ZyUFhEq3tgF39wXdVyBlRO0qYttyGm5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fsVL2lZAq7rIqFEKe5cAeMAIzJd5K6F74d8u3PSx15k=; b=HWrHMSYS7Z5733JUPWVopEFcRRC2W46cT+w8FuVZuerD/mfl7/PhVgZPPWsEfZoJFkm2dyEB401otfyU7PoLtqupTPDBLeYdxHw2tC+38zB8m/sxl++NzRw2JsJ4+r48BD5xaBN9N3kk8TM24BW8cWS4MTmk6+e6k+727SbYwU+7XkvJezcEkTnMfU3ZhwX7Af3pIREbpZTNMdFTsbpHA0rKk6ZGVnUx4kBbCOZucaIbUQVMbx1NUTep9ZRH6/DaG96dmgNJuvuvno791YTziADRdL+VoWrjqR/fjiDz48PrpV8AdyiqIzawaqDTNmfpAEqH9oW+AFiZya4432HFAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6304.namprd11.prod.outlook.com (2603:10b6:208:3c0::7) by BL0PR11MB3267.namprd11.prod.outlook.com (2603:10b6:208:6b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.18; Wed, 27 Jul 2022 12:59:13 +0000 Received: from MN0PR11MB6304.namprd11.prod.outlook.com ([fe80::8525:4565:6b49:dc55]) by MN0PR11MB6304.namprd11.prod.outlook.com ([fe80::8525:4565:6b49:dc55%6]) with mapi id 15.20.5458.024; Wed, 27 Jul 2022 12:59:13 +0000 Content-Type: multipart/mixed; boundary="------------WkB5RYIvIXZXBL69q70WuwOG" Message-ID: <442d2b9c-9f07-8954-b90e-b4a9f8b64303@intel.com> Date: Wed, 27 Jul 2022 20:59:00 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v3 1/3] mm/slub: enable debugging memory wasting of kmalloc Content-Language: en-US To: Christoph Lameter CC: Andrew Morton , Vlastimil Babka , Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "Hansen, Dave" , Robin Murphy , John Garry , Kefeng Wang References: <20220727071042.8796-1-feng.tang@intel.com> <20220727071042.8796-2-feng.tang@intel.com> From: Feng Tang In-Reply-To: X-ClientProxiedBy: SG2P153CA0033.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::20) To MN0PR11MB6304.namprd11.prod.outlook.com (2603:10b6:208:3c0::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e2fbfeff-e9c8-4fb4-e4ba-08da6fcfcdcb X-MS-TrafficTypeDiagnostic: BL0PR11MB3267:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DXMBEzN7h7qqTutaG0UyN9pYYMA3AkbxqqcIASV0gjLQprn9Sf+0o+sHzPj6u1y2WDwX7iumZ4rU9cBKNtk+2ZdxYCHkL2GHs+yEaTO+Bm2drxkRJL+ZI/qj5c8cLHhz1SmtT/Gr5RjeGXe3SNLEAG0sjgUeVYFGO/Ip+IPy5tSCXI+SyIWi2Yu4BVpFfI3A1edDm1QewT3jWzuiqvn/hW2F7ZCaFKzdhTBVvf3ZYUju6aKEKB2hImjmbdnFRH5v3oNq8K8x8tkvqwstGxHZgOQX5TjiLgIh4T9X232rfI4jOz3jUPk0raGb0Gj5yZheYC/Yfu2lz5R87KwpYMwAYLt2vYEjDUfkj34je18kK6dpl0WdOAa6BNb/EmmR6qPSrfOt/dkNfZYgsiVqp3dROLsdvL4Y/vtHwmhF73e1sJKvvMxCSFtMR030wgVkE5ctrGKI1CwDHb63BGDuLAFK17MOYZdJAiwjcNQ6x1pnHk2RkHAoGewV3AK3VRmSbUrxMmnYwv9x3AQU+EBgtWsQaCBxz1PK8pLJkkrpoGuppoiHQZDH2+MMHrtBQ88VcCyLYPS92qLwTZaNMnfciZ7shVAC8gNIMmInsfwTqIhbYQeoEwiOwoyYMwfqf9c2zVanH0RnWiN2iV6ZWnQIb5KuAs4V7dALd+pth1j77g0wtmOEE5PVTMuJxnfuQCKcwUuXsZdjXLwl/j4o4glSVBRRJELQgo3aajmnhqlScRbmuHXb93Jj0UxPxH7CjMhsYZZDGnz5S75EpopOs2AzUT+PIm+5ENqowEXv6AOp4uc6vbSyfY/VUjj/Jqlmqty3aAh7mzYRKAWaVtXXYoMm1Qv5fg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR11MB6304.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(396003)(39860400002)(376002)(346002)(26005)(83380400001)(6666004)(41300700001)(31686004)(6506007)(6486002)(6512007)(478600001)(53546011)(186003)(33964004)(36756003)(8936002)(5660300002)(235185007)(82960400001)(66946007)(316002)(2906002)(7416002)(8676002)(66556008)(86362001)(2616005)(44832011)(4326008)(66476007)(31696002)(54906003)(6916009)(38100700002)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L1FBSmpMeDZBa1lwSTNLNGlDSVAybVpaeXBsOW1tRkd2QzlqUVI2amlWcTc2?= =?utf-8?B?YS9SMFFQUUNRMFd6elNqNnlCSVNNNmxpWDZzT0M5L0VOelQ0SVVLbDNIbVBz?= =?utf-8?B?VWxTcndFVUZaWUpsTFhSdnJ2aEhVcjN5UEtKcFQ0NEszMHhjYjdic2YxQU5w?= =?utf-8?B?c3Z0NUlRUk9sanJhUmt1eTY5TTcvRlpkYmE3a1kvZG0zZzVCOElEYUNCbVdC?= =?utf-8?B?WjJaNmRMbFdnSXExSXlteGg4bitvRFlpUkhVTnp5M2ZVTGNLdC9kZVZxMTFa?= =?utf-8?B?T2N3THYyOFM1QVQwWHpaV2NNNlRYVXZ1Q2lWR2ZjNFhmTW5TSmJlMm5qV1Jp?= =?utf-8?B?OEIwcFRzblQwNGxYWnlHM0h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bfeff-e9c8-4fb4-e4ba-08da6fcfcdcb X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6304.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2022 12:59:12.9357 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: f2YJsykdQpdGfjsyoNV+knVM3WK/7UjQy45pC0Z+P+EMSt2ZwyBnYkaWUVI0XbSRujup6hecm1VgQ+A8DTtEmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3267 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --------------WkB5RYIvIXZXBL69q70WuwOG Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit On 2022/7/27 18:20, Christoph Lameter wrote: > On Wed, 27 Jul 2022, Feng Tang wrote: > >> @@ -2905,7 +2950,7 @@ static inline void *get_freelist(struct kmem_cache *s, struct slab *slab) >> * already disabled (which is the case for bulk allocation). >> */ >> static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, >> - unsigned long addr, struct kmem_cache_cpu *c) >> + unsigned long addr, struct kmem_cache_cpu *c, unsigned int orig_size) >> { >> void *freelist; >> struct slab *slab; >> @@ -3102,7 +3147,7 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, >> * pointer. >> */ >> static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, >> - unsigned long addr, struct kmem_cache_cpu *c) >> + unsigned long addr, struct kmem_cache_cpu *c, unsigned int orig_size) >> { >> void *p; >> >> @@ -3115,7 +3160,7 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, >> c = slub_get_cpu_ptr(s->cpu_slab); >> #endif >> >> - p = ___slab_alloc(s, gfpflags, node, addr, c); >> + p = ___slab_alloc(s, gfpflags, node, addr, c, orig_size); >> #ifdef CONFIG_PREEMPT_COUNT >> slub_put_cpu_ptr(s->cpu_slab); > > This is modifying and making execution of standard slab functions more > expensive. Could you restrict modifications to the kmalloc subsystem? > > kmem_cache_alloc() and friends are not doing any rounding up to power of > two sizes. > > What is happening here is that you pass kmalloc object size info through > the kmem_cache_alloc functions so that the regular allocation functions > debug functionality can then save the kmalloc specific object request > size. This is active even when no debugging options are enabled. Yes, it indeed is some extra cost which I don't like either. > > Can you avoid that? Have kmalloc do the object allocation without passing > through the kmalloc request size and then add the original size info > to the debug field later after execution continues in the kmalloc functions? How about the following patch which adds no new 'orig_size' to core functions (the following 2nd, 3rd redzone debug patch may also need some changes). (Our email server has just been changed, and my mutt can't work correctly, so the format could be broken, and I attached the new patch as well. Sorry for the inconvenience!) Thanks, Feng --- diff --git a/include/linux/slab.h b/include/linux/slab.h index 0fefdf528e0d..a713b0e5bbcd 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -29,6 +29,8 @@ #define SLAB_RED_ZONE ((slab_flags_t __force)0x00000400U) /* DEBUG: Poison objects */ #define SLAB_POISON ((slab_flags_t __force)0x00000800U) +/* Indicate a kmalloc slab */ +#define SLAB_KMALLOC ((slab_flags_t __force)0x00001000U) /* Align objs on cache lines */ #define SLAB_HWCACHE_ALIGN ((slab_flags_t __force)0x00002000U) /* Use GFP_DMA memory */ diff --git a/mm/slub.c b/mm/slub.c index 862dbd9af4f5..97c21a37a6a1 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -191,6 +191,12 @@ static inline bool kmem_cache_debug(struct kmem_cache *s) return kmem_cache_debug_flags(s, SLAB_DEBUG_FLAGS); } +static inline bool slub_debug_orig_size(struct kmem_cache *s) +{ + return (kmem_cache_debug_flags(s, SLAB_STORE_USER) && + (s->flags & SLAB_KMALLOC)); +} + void *fixup_red_left(struct kmem_cache *s, void *p) { if (kmem_cache_debug_flags(s, SLAB_RED_ZONE)) @@ -816,6 +822,39 @@ static void print_slab_info(const struct slab *slab) folio_flags(folio, 0)); } +static inline unsigned int *get_orig_size_pointer(struct kmem_cache *s, + void *object) +{ + void *p = kasan_reset_tag(object); + + p += get_info_end(s); + p += sizeof(struct track) * 2; + return (unsigned int *)p; +} + +static void set_orig_size(struct kmem_cache *s, + void *object, unsigned int orig_size) +{ + unsigned int *p; + + if (!slub_debug_orig_size(s)) + return; + + p = get_orig_size_pointer(s, object); + *p = orig_size; +} + +static unsigned int get_orig_size(struct kmem_cache *s, void *object) +{ + unsigned int *p; + + if (!slub_debug_orig_size(s)) + return s->object_size; + + p = get_orig_size_pointer(s, object); + return *p; +} + static void slab_bug(struct kmem_cache *s, char *fmt, ...) { struct va_format vaf; @@ -875,6 +914,9 @@ static void print_trailer(struct kmem_cache *s, struct slab *slab, u8 *p) if (s->flags & SLAB_STORE_USER) off += 2 * sizeof(struct track); + if (slub_debug_orig_size(s)) + off += sizeof(unsigned int); + off += kasan_metadata_size(s); if (off != size_from_object(s)) @@ -1026,10 +1068,14 @@ static int check_pad_bytes(struct kmem_cache *s, struct slab *slab, u8 *p) { unsigned long off = get_info_end(s); /* The end of info */ - if (s->flags & SLAB_STORE_USER) + if (s->flags & SLAB_STORE_USER) { /* We also have user information there */ off += 2 * sizeof(struct track); + if (s->flags & SLAB_KMALLOC) + off += sizeof(unsigned int); + } + off += kasan_metadata_size(s); if (size_from_object(s) == off) @@ -1335,6 +1381,7 @@ static noinline int alloc_debug_processing(struct kmem_cache *s, /* Success perform special debug activities for allocs */ if (s->flags & SLAB_STORE_USER) set_track(s, object, TRACK_ALLOC, addr); + trace(s, slab, object, 1); init_object(s, object, SLUB_RED_ACTIVE); return 1; @@ -3240,6 +3287,9 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, struct list_l init = slab_want_init_on_alloc(gfpflags, s); out: +#ifdef CONFIG_SLUB_DEBUG + set_orig_size(s, object, orig_size); +#endif slab_post_alloc_hook(s, objcg, gfpflags, 1, &object, init); return object; @@ -4112,12 +4162,17 @@ static int calculate_sizes(struct kmem_cache *s) } #ifdef CONFIG_SLUB_DEBUG - if (flags & SLAB_STORE_USER) + if (flags & SLAB_STORE_USER) { /* * Need to store information about allocs and frees after * the object. */ size += 2 * sizeof(struct track); + + /* Save the original kmalloc request size */ + if (flags & SLAB_KMALLOC) + size += sizeof(unsigned int); + } #endif kasan_cache_create(s, &size, &s->flags); @@ -4842,7 +4897,7 @@ void __init kmem_cache_init(void) /* Now we can use the kmem_cache to allocate kmalloc slabs */ setup_kmalloc_cache_index_table(); - create_kmalloc_caches(0); + create_kmalloc_caches(SLAB_KMALLOC); /* Setup random freelists for each cache */ init_freelist_randomization(); @@ -5068,6 +5123,7 @@ struct location { depot_stack_handle_t handle; unsigned long count; unsigned long addr; + unsigned long waste; long long sum_time; long min_time; long max_time; @@ -5114,13 +5170,15 @@ static int alloc_loc_track(struct loc_track *t, unsigned long max, gfp_t flags) } static int add_location(struct loc_track *t, struct kmem_cache *s, - const struct track *track) + const struct track *track, + unsigned int orig_size) { long start, end, pos; struct location *l; - unsigned long caddr, chandle; + unsigned long caddr, chandle, cwaste; unsigned long age = jiffies - track->when; depot_stack_handle_t handle = 0; + unsigned int waste = s->object_size - orig_size; #ifdef CONFIG_STACKDEPOT handle = READ_ONCE(track->handle); @@ -5138,11 +5196,13 @@ static int add_location(struct loc_track *t, struct kmem_cache *s, if (pos == end) break; - caddr = t->loc[pos].addr; - chandle = t->loc[pos].handle; - if ((track->addr == caddr) && (handle == chandle)) { + l = &t->loc[pos]; + caddr = l->addr; + chandle = l->handle; + cwaste = l->waste; + if ((track->addr == caddr) && (handle == chandle) && + (waste == cwaste)) { - l = &t->loc[pos]; l->count++; if (track->when) { l->sum_time += age; @@ -5167,6 +5227,9 @@ static int add_location(struct loc_track *t, struct kmem_cache *s, end = pos; else if (track->addr == caddr && handle < chandle) end = pos; + else if (track->addr == caddr && handle == chandle && + waste < cwaste) + end = pos; else start = pos; } @@ -5190,6 +5253,7 @@ static int add_location(struct loc_track *t, struct kmem_cache *s, l->min_pid = track->pid; l->max_pid = track->pid; l->handle = handle; + l->waste = waste; cpumask_clear(to_cpumask(l->cpus)); cpumask_set_cpu(track->cpu, to_cpumask(l->cpus)); nodes_clear(l->nodes); @@ -5208,7 +5272,7 @@ static void process_slab(struct loc_track *t, struct kmem_cache *s, for_each_object(p, s, addr, slab->objects) if (!test_bit(__obj_to_index(s, addr, p), obj_map)) - add_location(t, s, get_track(s, p, alloc)); + add_location(t, s, get_track(s, p, alloc), get_orig_size(s, p)); } #endif /* CONFIG_DEBUG_FS */ #endif /* CONFIG_SLUB_DEBUG */ @@ -6078,6 +6142,10 @@ static int slab_debugfs_show(struct seq_file *seq, void *v) else seq_puts(seq, ""); + if (l->waste) + seq_printf(seq, " waste=%lu/%lu", + l->count * l->waste, l->waste); + if (l->sum_time != l->min_time) { seq_printf(seq, " age=%ld/%llu/%ld", l->min_time, div_u64(l->sum_time, l->count), --------------WkB5RYIvIXZXBL69q70WuwOG Content-Type: text/x-patch; charset="UTF-8"; name="kmalloc_debug.patch" Content-Disposition: attachment; filename="kmalloc_debug.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2luY2x1ZGUvbGludXgvc2xhYi5oIGIvaW5jbHVkZS9saW51eC9zbGFiLmgK aW5kZXggMGZlZmRmNTI4ZTBkLi5hNzEzYjBlNWJiY2QgMTAwNjQ0Ci0tLSBhL2luY2x1ZGUvbGlu dXgvc2xhYi5oCisrKyBi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