From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85864C4743D for ; Sun, 6 Jun 2021 20:31:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 638F261029 for ; Sun, 6 Jun 2021 20:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbhFFUdn (ORCPT ); Sun, 6 Jun 2021 16:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229813AbhFFUdk (ORCPT ); Sun, 6 Jun 2021 16:33:40 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FF46C061766 for ; Sun, 6 Jun 2021 13:31:50 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d16so11523992pfn.12 for ; Sun, 06 Jun 2021 13:31:50 -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=QJw8DZU4yi86LnpH4Q8S+TCN5lpChk0DAgboMArge9U=; b=WRfP4cqukcmbPDthuW3N3/UKU+5lw1IPToj/yRY3sZmoOYdaAzhiSwskVQMdvbmfFs iWiqLIqhCfFBFVm1vj5gINDhgR3z4aB8aLYfA0KGyISwMTHNolDPVjoCUzCGM2AuFXpk OOBvD35VvqeimPiuKq+T2S1Crh3d/qt8OJg4rUS0lBpHD5nS71fr39Q54ksXdZ87Db9p dAXQrY7lJD0+TnIDmLSv8MUunB64mfvPLvKPGC8ci99ZELTLa3aoedKSSTvI1LR+BkaT gKtczoASYqFSCDt7oWLH/Gk4X69Z8XdIn9yz29VZL5Lz9x6kfHzTihlmRp9ZmnNbzch1 ssiw== 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=QJw8DZU4yi86LnpH4Q8S+TCN5lpChk0DAgboMArge9U=; b=udgF5iW3JQdS8j2u0XLD9QfoZ8Nz19GfYHks4dNLlZXjC2w3Z78h7xPEoKwZZKCD0x 9OjxMa9Zr0XCBMa0f5wZ4pW/y+Rc0dSDqtjH1fBKnW8H9hZnMoFAYABlVNYTwewJYEF9 +Fg1uNKTXg9xwrwuv9Kak2iRWwWIN+KdJ/P+xO4EVq/RZgM+J+1wgc3/U7wHKJ3jfs46 /hIgvo6fCs37k1UA6gnJuB+zPld5TQUSjjfvQLR5F31eeDHCqTOqGN4uq+7jES3ZDnbX l5QdYu1D2NewR7p6ca51MZkAZElq2SCA/8SdemBdKJhLerv8Qm4TH8jXXQisr0k2Jqr/ cZ7Q== X-Gm-Message-State: AOAM533Q7lvZnJ0+QGR8oPlX0ZqI8WLGLAiK3ZcAJquMMx2WjkxDtWL/ izlu2GJ5VW1e6BG/sZ3dGl2e+ATV0K5PbEmG/3E= X-Google-Smtp-Source: ABdhPJzTHcDivLpAKsIXprg7NM6DRuXQpT6zs+lkC1COf1HJRlayDCT+SWTjgYluLWtxFGnPI0/C+iWdXqJGqKrFZsA= X-Received: by 2002:a63:79c3:: with SMTP id u186mr14908427pgc.203.1623011505684; Sun, 06 Jun 2021 13:31:45 -0700 (PDT) MIME-Version: 1.0 References: <1622996045-25826-1-git-send-email-faiyazm@codeaurora.org> In-Reply-To: <1622996045-25826-1-git-send-email-faiyazm@codeaurora.org> From: Andy Shevchenko Date: Sun, 6 Jun 2021 23:31:29 +0300 Message-ID: Subject: Re: [PATCH v10] mm: slub: move sysfs slab alloc/free interfaces to debugfs To: Faiyaz Mohammed Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , linux-mm , Linux Kernel Mailing List , Greg KH , glittao@gmail.com, vinmenon@codeaurora.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 6, 2021 at 7:16 PM Faiyaz Mohammed wrote: > > alloc_calls and free_calls implementation in sysfs have two issues, > one is PAGE_SIZE limitiation of sysfs and other is it does not adhere limitation > to "one value per file" rule. > > To overcome this issues, move the alloc_calls and free_calls implemeation implementation > to debugfs. > > Debugfs cache will be created if SLAB_STORE_USER flag is set. > > Rename the alloc_calls/free_calls to alloc_traces/free_traces, > to be inline with what it does. ... > +#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_SLUB_DEBUG) > +void debugfs_slab_release(struct kmem_cache *); > +#else > +static inline void debugfs_slab_release(struct kmem_cache *s) > +{ > +} It can be one line. > +#endif ... > + if (l->sum_time != l->min_time) { > + seq_printf(seq, " age=%ld/%ld/%ld", > + l->min_time, > + (long)div_u64(l->sum_time, l->count), Hmm... Why is the cast needed here? > + l->max_time); > + } else > + seq_printf(seq, " age=%ld", > + l->min_time); ... > + if (num_online_cpus() > 1 && > + !cpumask_empty(to_cpumask(l->cpus))) One line? ... > +static const struct seq_operations slab_debugfs_sops = { > + .start = slab_debugfs_start, > + .next = slab_debugfs_next, > + .stop = slab_debugfs_stop, > + .show = slab_debugfs_show Leave a comma here. It might not be the last one in the future. > +}; + blank line? > +static int slab_debug_trace_open(struct inode *inode, struct file *filep) > +{ ... > +static const struct file_operations slab_debugfs_fops = { > + .open = slab_debug_trace_open, > + .read = seq_read, > + .llseek = seq_lseek, > + .release = slab_debug_trace_release, > +}; > + > + One blank line is enough. ... > + debugfs_remove_recursive(debugfs_lookup(s->name, > + slab_debugfs_root)); One line? -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD0D6C4743D for ; Sun, 6 Jun 2021 20:31:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6DAFE613C7 for ; Sun, 6 Jun 2021 20:31:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DAFE613C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AAD4D6B006C; Sun, 6 Jun 2021 16:31:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A5D366B006E; Sun, 6 Jun 2021 16:31:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B0EF6B0070; Sun, 6 Jun 2021 16:31:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 5B0E66B006C for ; Sun, 6 Jun 2021 16:31:47 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E549A181AC9CC for ; Sun, 6 Jun 2021 20:31:46 +0000 (UTC) X-FDA: 78224445012.35.ED4C459 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by imf20.hostedemail.com (Postfix) with ESMTP id A19E5F2 for ; Sun, 6 Jun 2021 20:31:44 +0000 (UTC) Received: by mail-pf1-f171.google.com with SMTP id u18so11534646pfk.11 for ; Sun, 06 Jun 2021 13:31:46 -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=QJw8DZU4yi86LnpH4Q8S+TCN5lpChk0DAgboMArge9U=; b=WRfP4cqukcmbPDthuW3N3/UKU+5lw1IPToj/yRY3sZmoOYdaAzhiSwskVQMdvbmfFs iWiqLIqhCfFBFVm1vj5gINDhgR3z4aB8aLYfA0KGyISwMTHNolDPVjoCUzCGM2AuFXpk OOBvD35VvqeimPiuKq+T2S1Crh3d/qt8OJg4rUS0lBpHD5nS71fr39Q54ksXdZ87Db9p dAXQrY7lJD0+TnIDmLSv8MUunB64mfvPLvKPGC8ci99ZELTLa3aoedKSSTvI1LR+BkaT gKtczoASYqFSCDt7oWLH/Gk4X69Z8XdIn9yz29VZL5Lz9x6kfHzTihlmRp9ZmnNbzch1 ssiw== 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=QJw8DZU4yi86LnpH4Q8S+TCN5lpChk0DAgboMArge9U=; b=Zq6F2jwgcWtUY7KezzYO2jppMXXxyeuIZNywfHGwlwgOx/MhtNO/UTJKZr98cB+0cb MHEj7H7+My2FArRnhLM/e3m+YPdcAsw39gp2wr+ErR4o+HLn7OkQym3O44fXgMhGPenW xl1QVi1PEIh+6yZ9sBjYH5G4L7Qwx88reE8gblbsdFOLZIizDaMSYaZ9hxf6FcXkH7VM elpfhtthJ5mQZeGgS3Wqwv7sJPQiZiO2li8zb/o2cfzH7z2QMzfBLODs6PEUyVGRSHnL bL9E63fnoB8xMwscFe9SD2ioD5b8a4fXyEHcWQK80htzIbnrC6jolQZjDnrHodPF9y12 M+CQ== X-Gm-Message-State: AOAM53072LEVjHtC3KYaKNZOfqCJOnU/MPNkNpD5oFx2tYS+OFhH4r6q tCtA2DO/g8FWu3m60xH/UfgfzdNfWrizCw5ggF0= X-Google-Smtp-Source: ABdhPJzTHcDivLpAKsIXprg7NM6DRuXQpT6zs+lkC1COf1HJRlayDCT+SWTjgYluLWtxFGnPI0/C+iWdXqJGqKrFZsA= X-Received: by 2002:a63:79c3:: with SMTP id u186mr14908427pgc.203.1623011505684; Sun, 06 Jun 2021 13:31:45 -0700 (PDT) MIME-Version: 1.0 References: <1622996045-25826-1-git-send-email-faiyazm@codeaurora.org> In-Reply-To: <1622996045-25826-1-git-send-email-faiyazm@codeaurora.org> From: Andy Shevchenko Date: Sun, 6 Jun 2021 23:31:29 +0300 Message-ID: Subject: Re: [PATCH v10] mm: slub: move sysfs slab alloc/free interfaces to debugfs To: Faiyaz Mohammed Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , linux-mm , Linux Kernel Mailing List , Greg KH , glittao@gmail.com, vinmenon@codeaurora.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A19E5F2 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=WRfP4cqu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of andyshevchenko@gmail.com designates 209.85.210.171 as permitted sender) smtp.mailfrom=andyshevchenko@gmail.com X-Stat-Signature: mucs9jhz5p379atqc5mrxm6ysg8gj5oz X-HE-Tag: 1623011504-294155 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, Jun 6, 2021 at 7:16 PM Faiyaz Mohammed wrote: > > alloc_calls and free_calls implementation in sysfs have two issues, > one is PAGE_SIZE limitiation of sysfs and other is it does not adhere limitation > to "one value per file" rule. > > To overcome this issues, move the alloc_calls and free_calls implemeation implementation > to debugfs. > > Debugfs cache will be created if SLAB_STORE_USER flag is set. > > Rename the alloc_calls/free_calls to alloc_traces/free_traces, > to be inline with what it does. ... > +#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_SLUB_DEBUG) > +void debugfs_slab_release(struct kmem_cache *); > +#else > +static inline void debugfs_slab_release(struct kmem_cache *s) > +{ > +} It can be one line. > +#endif ... > + if (l->sum_time != l->min_time) { > + seq_printf(seq, " age=%ld/%ld/%ld", > + l->min_time, > + (long)div_u64(l->sum_time, l->count), Hmm... Why is the cast needed here? > + l->max_time); > + } else > + seq_printf(seq, " age=%ld", > + l->min_time); ... > + if (num_online_cpus() > 1 && > + !cpumask_empty(to_cpumask(l->cpus))) One line? ... > +static const struct seq_operations slab_debugfs_sops = { > + .start = slab_debugfs_start, > + .next = slab_debugfs_next, > + .stop = slab_debugfs_stop, > + .show = slab_debugfs_show Leave a comma here. It might not be the last one in the future. > +}; + blank line? > +static int slab_debug_trace_open(struct inode *inode, struct file *filep) > +{ ... > +static const struct file_operations slab_debugfs_fops = { > + .open = slab_debug_trace_open, > + .read = seq_read, > + .llseek = seq_lseek, > + .release = slab_debug_trace_release, > +}; > + > + One blank line is enough. ... > + debugfs_remove_recursive(debugfs_lookup(s->name, > + slab_debugfs_root)); One line? -- With Best Regards, Andy Shevchenko