From 2f43f915a6dadd33057f7d337beffbf32e148fd2 Mon Sep 17 00:00:00 2001 From: Ruslan Cheremin Date: Thu, 2 Jan 2025 14:49:51 +0100 Subject: [PATCH] [core] disable new `FilePageCache` + `FilePageCacheLockFree` was developed to replace regular `FilePageCache` but that project was postponed for a long time in favor of using memory-mapped files for performance-critical storages. Current storages don't use `FilePageCacheLockFree`, hence it pays off disabling it and yield ~120Mb of native memory to regular `FilePageCache` GitOrigin-RevId: ad6ceb85f891e6e737972f208c276582789cdb4f --- .../util/io/storage/VFSContentStorageAdapterTest.java | 11 ++++++++++- .../util/src/com/intellij/util/io/PageCacheUtils.java | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/util/io/storage/VFSContentStorageAdapterTest.java b/platform/platform-tests/testSrc/com/intellij/util/io/storage/VFSContentStorageAdapterTest.java index e00f7722c5ec..49d1e71b738e 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/io/storage/VFSContentStorageAdapterTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/io/storage/VFSContentStorageAdapterTest.java @@ -1,11 +1,13 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.io.storage; import com.intellij.openapi.vfs.newvfs.persistent.dev.content.ContentHashEnumeratorOverDurableEnumerator; import com.intellij.openapi.vfs.newvfs.persistent.dev.content.ContentStorageAdapter; +import com.intellij.util.io.PageCacheUtils; import com.intellij.util.io.storage.lf.RefCountingContentStorageImplLF; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; import java.io.IOException; import java.nio.file.Path; @@ -13,11 +15,18 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import static com.intellij.util.io.storage.CapacityAllocationPolicy.FIVE_PERCENT_FOR_GROWTH; +import static org.junit.jupiter.api.Assumptions.assumeTrue; public class VFSContentStorageAdapterTest extends VFSContentStorageTestBase { private ExecutorService storingPool; + @BeforeAll + static void checkLockFreeEnabled() { + assumeTrue(PageCacheUtils.LOCK_FREE_PAGE_CACHE_ENABLED, + "ContentHashEnumeratorOverDurableEnumerator expects lock-free FilePageCache to be enabled"); + } + @Override protected @NotNull ContentStorageAdapter openStorage(@NotNull Path storagePath) throws IOException { storingPool = Executors.newSingleThreadExecutor(r -> new Thread(r, "ContentWriting Pool")); diff --git a/platform/util/src/com/intellij/util/io/PageCacheUtils.java b/platform/util/src/com/intellij/util/io/PageCacheUtils.java index e2019541e895..7318c776dac9 100644 --- a/platform/util/src/com/intellij/util/io/PageCacheUtils.java +++ b/platform/util/src/com/intellij/util/io/PageCacheUtils.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.io; import com.intellij.openapi.diagnostic.Logger; @@ -46,7 +46,7 @@ public final class PageCacheUtils { * So far both new and {@link FilePageCache legacy} file caches co-exist: storages are incrementally migrated * to new cache */ - public static final boolean LOCK_FREE_PAGE_CACHE_ENABLED = getBooleanProperty("vfs.lock-free-impl.enable", true); + public static final boolean LOCK_FREE_PAGE_CACHE_ENABLED = getBooleanProperty("vfs.lock-free-impl.enable", false); /** * How much direct memory the new (code name 'lock-free') FilePageCache impl allowed to utilize: as a fraction