From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zdenek Kabelac Date: Mon, 25 Oct 2010 13:33:20 +0200 Subject: [PATCH 16/30] Fix void* pointer arithmetic In-Reply-To: <4CC568B4.4020002@redhat.com> References: <4CC568B4.4020002@redhat.com> Message-ID: <4CC56B00.4050404@redhat.com> List-Id: To: lvm-devel@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Dne 25.10.2010 13:23, Milan Broz napsal(a): > On 10/25/2010 10:24 AM, Zdenek Kabelac wrote: > >> static void _touch_memory(void *mem, size_t size) >> { >> size_t pagesize = lvm_getpagesize(); >> - void *pos = mem; >> - void *end = mem + size - sizeof(long); >> + char *pos = mem; >> + char *end = pos + size - sizeof(long); > > And what about trash this "touch memory" code completely? > > The whole idea of touching memory before locking is IMHO obsolete. > > Locking memory should do this implicitly - can we prove that this > code has some effect on recent systems? > Our memlock code should be physically allocating and paging all the memory to the process space - so the only difference is IMHO at which point in time memory failure happens - with memory touching - it might occur sooner in some cases - but we lose some speed by trashing CPU cache and flagging memory pages. Zdenek