linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Minchan Kim <minchan@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	sergey.senozhatsky@gmail.com, iamjoonsoo.kim@lge.com,
	ngupta@vflare.org, zhouxianrong@huawei.com, zhouxiyu@huawei.com,
	weidu.du@huawei.com, zhangshiming5@huawei.com,
	Mi.Sophia.Wang@huawei.com, won.ho.park@huawei.com, liw@liw.fi
Subject: Re: memfill
Date: Wed, 8 Feb 2017 13:54:35 -0800	[thread overview]
Message-ID: <20170208215435.GP2267@bombadil.infradead.org> (raw)
In-Reply-To: <1486587668.2484.37.camel@HansenPartnership.com>

On Wed, Feb 08, 2017 at 01:01:08PM -0800, James Bottomley wrote:
> Yes, that's about it.  My only qualm looking at the proposal was if
> memfill is genuinely useful to something why would it only want to fill
> in units of sizeof(long).  On the other hand, we've been operating for
> decades without it, so perhaps memset_l is the only use case?

I suspect we've grown hundreds of unoptimised implementations of this all
over the kernel.  I mean, look at the attitude of the zram developers when
I suggested memfill: "this is beyond zram scope."  I think finding all of
these is beyond the abilities of grep.  maybe coccinelle could find some?

Instead I chose a driver at random that both you and I are familiar with,
sym53c8xx_2.  Oh, look, here's one:

        np->badlun_sa = cpu_to_scr(SCRIPTB_BA(np, resel_bad_lun));
        for (i = 0 ; i < 64 ; i++)      /* 64 luns/target, no less */
                np->badluntbl[i] = cpu_to_scr(vtobus(&np->badlun_sa));

and another one:

                for (i = 0 ; i < 64 ; i++)
                        tp->luntbl[i] = cpu_to_scr(vtobus(&np->badlun_sa));

and another:

        for (i = 0 ; i < SYM_CONF_MAX_TASK ; i++)
                lp->itlq_tbl[i] = cpu_to_scr(np->notask_ba);

I don't think any of these are performance path, but they're there.

Maybe SCSI drivers are unusual.  Let's try a random network driver, e1000e:

        /* Clear shadow ram */
        for (i = 0; i < nvm->word_size; i++) {
                dev_spec->shadow_ram[i].modified = false;
                dev_spec->shadow_ram[i].value = 0xFFFF;
        }

(three of those loops)

I mean, it's not going to bring the house down, but that I chose two
drivers more or less at random and found places where such an API could
be used indicates there may be more places this should be used.  And it
gives architectures a good place to plug in a performance optimisation
for zram rather than hiding it away in that funny old driver almost
nobody looks at.

  reply	other threads:[~2017-02-08 21:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-05 15:16 [PATCH v4] zram: extend zero pages to same element pages Minchan Kim
2017-02-06 14:49 ` memfill Matthew Wilcox
2017-02-07  2:47   ` memfill zhouxianrong
2017-02-07  4:59   ` memfill Minchan Kim
2017-02-07 19:07   ` memfill James Bottomley
2017-02-08 18:04     ` memfill Matthew Wilcox
2017-02-08 21:01       ` memfill James Bottomley
2017-02-08 21:54         ` Matthew Wilcox [this message]
2017-02-07  6:57 ` [PATCH v4] zram: extend zero pages to same element pages Minchan Kim
2017-02-07  9:40 ` memfill David Howells
2017-02-07 17:22   ` memfill Matthew Wilcox
2017-02-07 17:29   ` memfill David Howells
2017-02-07 19:03     ` memfill Matthew Wilcox
2017-03-11 14:56 ` memfill v2 now with ARM and x86 implementations Matthew Wilcox
2017-03-13  5:17   ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170208215435.GP2267@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=Mi.Sophia.Wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liw@liw.fi \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=weidu.du@huawei.com \
    --cc=won.ho.park@huawei.com \
    --cc=zhangshiming5@huawei.com \
    --cc=zhouxianrong@huawei.com \
    --cc=zhouxiyu@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).