1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Do not use the Linux mremap() call. Use the same strategy for xMremap() as on OSX instead.

FossilOrigin-Name: 5ed8ad780c991d2ca44003ee84350fb5e95ad58e
This commit is contained in:
dan
2013-03-21 14:47:47 +00:00
parent d306e1a3a1
commit c71b45e619
3 changed files with 13 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
C Optimize\sthe\sxMremap\smethod\sin\sos_unix.c\ssome. C Do\snot\suse\sthe\sLinux\smremap()\scall.\sUse\sthe\ssame\sstrategy\sfor\sxMremap()\sas\son\sOSX\sinstead.
D 2013-03-20T18:25:49.737 D 2013-03-21T14:47:47.427
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 9a804abbd3cae82d196e4d33aba13239e32522a5 F Makefile.in 9a804abbd3cae82d196e4d33aba13239e32522a5
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -160,7 +160,7 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
F src/os.c 87ea1cd1259c5840848e34007d72e772a2ab7528 F src/os.c 87ea1cd1259c5840848e34007d72e772a2ab7528
F src/os.h 8d92f87f5fe14b060a853ca704b8ef6d3daee79b F src/os.h 8d92f87f5fe14b060a853ca704b8ef6d3daee79b
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_unix.c c96bdc9e912c0f8226a03cd025566b5a43e1c387 F src/os_unix.c be66c31337361a72227638d6f41c7f2031739642
F src/os_win.c f7da4dc0a2545c0a430080380809946ae4d676d6 F src/os_win.c f7da4dc0a2545c0a430080380809946ae4d676d6
F src/pager.c d59af9a70aa2d7222b127351fa3cbe70660e4150 F src/pager.c d59af9a70aa2d7222b127351fa3cbe70660e4150
F src/pager.h 241d72dc0905df042da165f086d03505cb0bb50c F src/pager.h 241d72dc0905df042da165f086d03505cb0bb50c
@@ -1039,7 +1039,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 14135da3cdbafd699563a29608f32347cda28338 P 9529ed88a71fee02fae72dc86f0669bd6856ff92
R ae7e97a190e1fdc49e8b167e558562e7 R 7e61f02cabbded666ed9e0992a636a37
U dan U dan
Z a86246ff854d247b1925a564cb8b08dc Z 67f89f7e2101ab4157bb24e7a7ac302a

View File

@@ -1 +1 @@
9529ed88a71fee02fae72dc86f0669bd6856ff92 5ed8ad780c991d2ca44003ee84350fb5e95ad58e

View File

@@ -4478,16 +4478,12 @@ static int unixMremap(
** it is possible to create a mapping larger than the file on disk and ** it is possible to create a mapping larger than the file on disk and
** extend the file on disk later on. ** extend the file on disk later on.
** **
** Exploit this on OSX to reduce the number of munmap()/mmap() calls ** Exploit this on Linux and OSX to reduce the number of munmap()/mmap()
** if the file size is changing. In this case all mappings are rounded ** calls required if the file size is changing. In this case all mappings
** up to the nearest 4MB. And if a new mapping is requested that has the ** are rounded up to the nearest 4MB. And if a new mapping is requested
** same rounded size as an old mapping, the old mapping can simply be ** that has the same rounded size as an old mapping, the old mapping can
** reused as is. ** be reused as is. */
** #if defined(__APPLE__) || defined(__linux__)
** It would be possible to do the above on Linux too. However, Linux has
** the non-standard mremap() call to resize existing mappings, which can
** be used instead. */
#if defined(__APPLE__)
nNewRnd = ROUNDUP(nNew, 4096*1024); nNewRnd = ROUNDUP(nNew, 4096*1024);
nOldRnd = ROUNDUP(nOld, 4096*1024); nOldRnd = ROUNDUP(nOld, 4096*1024);
#else #else
@@ -4502,20 +4498,6 @@ static int unixMremap(
} }
#endif #endif
/* On Linux, if there is both an old and new mapping, resize the old
** mapping using the non-standard mremap() call. */
#if defined(_GNU_SOURCE) && defined(__linux__)
if( nNewRnd && nOldRnd ){
void *pOld = *ppMap;
*ppMap = pNew = mremap(pOld, nOldRnd, nNewRnd, MREMAP_MAYMOVE);
if( pNew==MAP_FAILED ){
*ppMap = 0;
return SQLITE_IOERR_MREMAP;
}
return SQLITE_OK;
}
#endif
/* If we get this far, unmap any old mapping. */ /* If we get this far, unmap any old mapping. */
if( nOldRnd!=0 ){ if( nOldRnd!=0 ){
void *pOld = *ppMap; void *pOld = *ppMap;