Merge pull request 'Fix madvise code' (#37) from master into release
Reviewed-on: https://git.marginalia.nu/marginalia/marginalia.nu/pulls/37
This commit is contained in:
commit
44e2bc18a6
@ -127,15 +127,15 @@ public class MultimapFileLong implements AutoCloseable, MultimapFileLongSlice {
|
|||||||
var buff = mappedByteBuffers.get((int)(startLongs / bufferSize));
|
var buff = mappedByteBuffers.get((int)(startLongs / bufferSize));
|
||||||
|
|
||||||
if ((int)(startLongs / bufferSize) != (int)((endLongs) / bufferSize)) {
|
if ((int)(startLongs / bufferSize) != (int)((endLongs) / bufferSize)) {
|
||||||
logger.warn("Misaligned madvise, skipping");
|
logger.debug("Misaligned madvise, skipping");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeIO.madviseRange(buff, advice, (startLongs % bufferSize) * WORD_SIZE, (int)(lengthLongs*WORD_SIZE));
|
NativeIO.madviseRange(buff, advice, (startLongs % bufferSize) * WORD_SIZE, (int)(lengthLongs*WORD_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pokeRange(long offset, int length) {
|
public void pokeRange(long offset, long length) {
|
||||||
for (int i = 0; i < length; i += 4096/8) {
|
for (long i = 0; i < length; i += 4096/8) {
|
||||||
get(offset + i);
|
get(offset + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.name.Named;
|
import com.google.inject.name.Named;
|
||||||
import com.upserve.uppend.blobs.NativeIO;
|
import com.upserve.uppend.blobs.NativeIO;
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
import nu.marginalia.wmsa.edge.index.conversion.SearchIndexConverter;
|
|
||||||
import nu.marginalia.util.btree.BTreeReader;
|
import nu.marginalia.util.btree.BTreeReader;
|
||||||
import nu.marginalia.util.multimap.MultimapFileLong;
|
import nu.marginalia.util.multimap.MultimapFileLong;
|
||||||
|
import nu.marginalia.wmsa.edge.index.conversion.SearchIndexConverter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public class SearchIndex implements AutoCloseable {
|
|||||||
urls.advice(NativeIO.Advice.Random);
|
urls.advice(NativeIO.Advice.Random);
|
||||||
words.forEachWordsOffset(offset -> {
|
words.forEachWordsOffset(offset -> {
|
||||||
var h = reader.getHeader(offset);
|
var h = reader.getHeader(offset);
|
||||||
int length = (int) (h.dataOffsetLongs() - h.indexOffsetLongs());
|
long length = h.dataOffsetLongs() - h.indexOffsetLongs();
|
||||||
|
|
||||||
urls.adviceRange(NativeIO.Advice.Normal, offset, 512);
|
urls.adviceRange(NativeIO.Advice.Normal, offset, 512);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user