Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp220815imm; Tue, 5 Jun 2018 18:27:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIZy5gLP0imnercVY6iNj7Q3/cNpiqlhZfvSy483z9KRle933SYwEMprJxL1LYBcILY6i7A X-Received: by 2002:a65:5143:: with SMTP id g3-v6mr831551pgq.190.1528248430508; Tue, 05 Jun 2018 18:27:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528248430; cv=none; d=google.com; s=arc-20160816; b=d4IiUG5Oa448TM7bPrTQeGxktAa6yaOQ9+os4kdY8nAdJ8zuK/vthukedpuh3OQKug HYUlwFNNEhREOE4QWzk8ejgXC767C2kabKLSFHmfbUvo8q2vizdVj09/XOWkh9/nHMM4 a+mDvgibXWJqaiOJY5mfZJTJxG8RQAWGa3NMJljWIweSe0nz1l8RPtGOvEDA43pBt//H OU6JFWc8XfrTWBZ6Ri2TDv3J21/ZgLngchqK/IKfrjxmSacojabJpaPTBrIAK1MdMRu4 +8HdfQ4gE0Bt6nGD6XcgSF1VsLg6LnzY5fZaWdiywYMKgpJfZrNcU3+XyDtyvsQOZw93 pVzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=6pi8EH4gRsiGLxOcdLwKc8VI2cNPw9vUZefR5qPenfY=; b=xIh69l1g1d/jaZXTQa7sIDOOi4HLLYhfZ4JTIOGJhPxCcngyIr3I2myeUb/dwZkmV7 Q725Yz8tvxtjcnLGbyd2Qu5Il4F9XlrV+IDfUNTZg5BafSXRUYq+L75lwT3f8kwkeB7c GbJ0Q/iA0nXHN/mZ05MPwGGdjalf7se7S9Y6gZkxu+22sjGrVAKRda6if2VK+tR9k+9e fWfTX630Tbv4ZfKpEb5KZvJMfHkEdbFJKrC4H7aWVaPWatLYu7DfhV+idQtE6h+p4ETe JhmeY9zX7+bILQzlwnOHlyuQQqzIXY6HeEZ3UtirgtBSVloOa5SeXJOY2EGQzWJ44blr zYUA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si50809966plc.203.2018.06.05.18.26.55; Tue, 05 Jun 2018 18:27:10 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932072AbeFFB0a (ORCPT + 99 others); Tue, 5 Jun 2018 21:26:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35392 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752063AbeFFB03 (ORCPT ); Tue, 5 Jun 2018 21:26:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2189840711D6; Wed, 6 Jun 2018 01:26:29 +0000 (UTC) Received: from localhost (ovpn-8-17.pek2.redhat.com [10.72.8.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD4B51002963; Wed, 6 Jun 2018 01:26:27 +0000 (UTC) Date: Wed, 6 Jun 2018 09:26:24 +0800 From: Baoquan He To: Christopher Lameter Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org Subject: Re: [PATCH] slab: Clean up the code comment in slab kmem_cache struct Message-ID: <20180606012624.GA19425@MiWiFi-R3L-srv> References: <20180603032402.27526-1-bhe@redhat.com> <01000163d0e8083c-096b06d6-7202-4ce2-b41c-0f33784afcda-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01000163d0e8083c-096b06d6-7202-4ce2-b41c-0f33784afcda-000000@email.amazonses.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 06 Jun 2018 01:26:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 06 Jun 2018 01:26:29 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'bhe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/05/18 at 05:04pm, Christopher Lameter wrote: > On Sun, 3 Jun 2018, Baoquan He wrote: > > > diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h > > index d9228e4d0320..3485c58cfd1c 100644 > > --- a/include/linux/slab_def.h > > +++ b/include/linux/slab_def.h > > @@ -67,9 +67,10 @@ struct kmem_cache { > > > > /* > > * If debugging is enabled, then the allocator can add additional > > - * fields and/or padding to every object. size contains the total > > - * object size including these internal fields, the following two > > - * variables contain the offset to the user object and its size. > > + * fields and/or padding to every object. 'size' contains the total > > + * object size including these internal fields, while 'obj_offset' > > + * and 'object_size' contain the offset to the user object and its > > + * size. > > */ > > int obj_offset; > > #endif /* CONFIG_DEBUG_SLAB */ > > > > Wish we had some more consistent naming. object_size and obj_offset??? And > the fields better be as close together as possible. I am back porting Thomas's sl[a|u]b freelist randomization feature to our distros, need go through slab code for better understanding. From git log history, they were 'obj_offset' and 'obj_size'. Later on 'obj_size' was renamed to 'object_size' in commit 3b0efdfa1e("mm, sl[aou]b: Extract common fields from struct kmem_cache") which is from your patch. With my understanding, I guess you changed that on purpose because object_size is size of each object, obj_offset is for the whole cache, representing the offset the real object starts to be stored. And putting them separately is for better desribing them in code comment and distinction, e.g 'object_size' is in "4) cache creation/removal", while 'obj_offset' is put alone to indicate it's for the whole.