[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150323.150833.1435862810481480096.davem@davemloft.net>
Date: Mon, 23 Mar 2015 15:08:33 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: torvalds@...ux-foundation.org
Cc: david.ahern@...cle.com, sparclinux@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, bpicco@...oft.net
Subject: Re: 4.0.0-rc4: panic in free_block
From: Linus Torvalds <torvalds@...ux-foundation.org>
Date: Mon, 23 Mar 2015 10:00:02 -0700
> Maybe the code could be something like
>
> void *memmove(void *dst, const void *src, size_t n);
> {
> // non-overlapping cases
> if (src + n <= dst)
> return memcpy(dst, src, n);
> if (dst + n <= src)
> return memcpy(dst, src, n);
>
> // overlapping, but we know we
> // (a) copy upwards
> // (b) initialize the result in at most chunks of 64
> if (dst+64 <= src)
> return memcpy(dst, src, n);
>
> .. do the backwards thing ..
> }
>
> (ok, maybe I got it wrong, but you get the idea).
>
> I *think* gcc should do ok on the above kind of code, and not generate
> wildly different code from your handcoded version.
Sure you could do that in C, but I really want to avoid using memcpy()
if dst and src overlap in any way at all.
Said another way, I don't want to codify that "64" thing. The next
chip could do 128 byte initializing stores.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists