Ensure --mlock works properly with mmap() support

This commit is contained in:
Justine Tunney 2023-03-30 01:53:36 -07:00
parent 78ca9838ee
commit 6f23ba5ee2
3 changed files with 34 additions and 16 deletions

View file

@ -1595,7 +1595,10 @@ struct llama_context * llama_init_from_file(
if (params.use_mlock) {
char *err;
if (!ggml_mlock(ctx->model.ctx, &err)) {
if (!ggml_mlock(ctx->model.ctx,
ctx->model.mm_addr,
ctx->model.mm_length,
&err)) {
fprintf(stderr, "%s\n", err);
free(err);
llama_free(ctx);