Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp456720imu; Fri, 21 Dec 2018 01:57:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN75JZOqDtMQ9tGX1lIWiK8Qjiz4j3eDG0zbdiu+W+sYI4sup4dKFxxcp2Z/klJ9mgX2L64/ X-Received: by 2002:a17:902:6bc7:: with SMTP id m7mr1884716plt.106.1545386222978; Fri, 21 Dec 2018 01:57:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545386222; cv=none; d=google.com; s=arc-20160816; b=LZulXMJBTgxGVzRUjj7IvDRLDdfVaLHVpBV+mb6ellrbCOpMeOQhcGRyEUQxo7Vf/k KcWg1Fthe+kNyoR9pBbDdqWHvhiW4GsmFrm74Q2pxPguENrQaYWllPoLic1+QwIulEHk RaYW2jBG+KXM6BPXyzHoH7bXJhpS6d7FjdS1Cub/u6XiPwpajNOuzCBRObu3q4If5OAX x3M4rTksgbp22RA7uXjx21c5H5coBnGHY9JZ3DzRuyv9r8kWakbBRdzrNxQQnDPJg/wr WPMUPcXWkzSnv7nR2qLcyjQ7R1u8QiUDbiXTfM5n95pKIPSqm/MYXM5Cccx7lp0EF1IP L7RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:content-disposition :mime-version:references:subject:cc:cc:cc:cc:cc:cc:cc:cc:cc:cc:cc:to :from:date:user-agent:message-id:dkim-signature; bh=WG4AB0pljQcpBmeuz1B8F5G9pA0mj9v/xq+gyFWGAVI=; b=jlHBRafzgEgqgJTVniu1IsSgELtjTeIDfb/UILQMPpGYDud9R7PnU7whiZDaZxt0KI 2OYWhNjwu3FanAjn6FKMtqE8mLaN+OfOus12BM9N4Nu9N8h0dpQ/0abbI6Zqobvl+Lc8 LPFNwUyAoQYhd70Qta8t+0i/FZjnPJ1vKc6YIgqpWFAhpmxfRlMs6T2U2OWeH8sHlgbQ PT4cBLKhg8iLX1Zpqm89ARdJYLsFWNxb8MyElPboA/IjeFROp07Qhfsmal9w87J515A+ mJfNsffgfl3G8GXDYJyC6XT429NiuNH2oih/sJMVOGcFyT/FYdH5lrhi6vUCp86Egvxh J0Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=TfSWvzq+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cc16si10134483plb.377.2018.12.21.01.56.44; Fri, 21 Dec 2018 01:57:02 -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=fail header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=TfSWvzq+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389362AbeLTTWB (ORCPT + 99 others); Thu, 20 Dec 2018 14:22:01 -0500 Received: from a9-36.smtp-out.amazonses.com ([54.240.9.36]:34420 "EHLO a9-36.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731103AbeLTTV5 (ORCPT ); Thu, 20 Dec 2018 14:21:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1545333716; h=Message-Id:Date:From:To:Cc:Cc:Cc:CC:Cc:Cc:Cc:Cc:Cc:Cc:Cc:Subject:References:MIME-Version:Content-Type:Feedback-ID; bh=VdAFswNkZMzX1QnleI6nNoe36Hgyo5dlWLZMARfK7f8=; b=TfSWvzq+iWaub44mB9Mn8ltb+L1g6QW1S5kgNN/HUVsnK258K9k740hUbuDhEOMG bYTUyXxdL0Y3gmb2B+0S4/pIEqgRxEs5Qta6XL+73oW3WxvfSEyEN9EAbgWYzKYXFMv 5dYhndZ2/byo4T9TMaGK71a7AaJMFgPyIpndY2ts= Message-ID: <01000167cd113509-2c85d8a3-8e0e-4cb6-a745-88733e448471-000000@email.amazonses.com> User-Agent: quilt/0.65 Date: Thu, 20 Dec 2018 19:21:56 +0000 From: Christoph Lameter To: Matthew Wilcox Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Cc: Pekka Enberg CC: akpm@linux-foundation.org Cc: Mel Gorman Cc: andi@firstfloor.org Cc: Rik van Riel Cc: Dave Chinner Cc: Christoph Hellwig Cc: Michal Hocko Cc: Mike Kravetz Subject: [RFC 1/7] slub: Replace ctor field with ops field in /sys/slab/* References: <20181220192145.023162076@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=ctor_to_ops X-SES-Outgoing: 2018.12.20-54.240.9.36 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Create an ops field in /sys/slab/*/ops to contain all the callback operations defined for a slab cache. This will be used to display the additional callbacks that will be defined soon to enable defragmentation. Display the existing ctor callback in the ops fields contents. Signed-off-by: Christoph Lameter --- mm/slub.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) Index: linux/mm/slub.c =================================================================== --- linux.orig/mm/slub.c +++ linux/mm/slub.c @@ -4994,13 +4994,18 @@ static ssize_t cpu_partial_store(struct } SLAB_ATTR(cpu_partial); -static ssize_t ctor_show(struct kmem_cache *s, char *buf) +static ssize_t ops_show(struct kmem_cache *s, char *buf) { + int x = 0; + if (!s->ctor) return 0; - return sprintf(buf, "%pS\n", s->ctor); + + if (s->ctor) + x += sprintf(buf + x, "ctor : %pS\n", s->ctor); + return x; } -SLAB_ATTR_RO(ctor); +SLAB_ATTR_RO(ops); static ssize_t aliases_show(struct kmem_cache *s, char *buf) { @@ -5413,7 +5418,7 @@ static struct attribute *slab_attrs[] = &objects_partial_attr.attr, &partial_attr.attr, &cpu_slabs_attr.attr, - &ctor_attr.attr, + &ops_attr.attr, &aliases_attr.attr, &align_attr.attr, &hwcache_align_attr.attr,