mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
nvmap: Use conftest to finding shrinker_alloc() presence
Use conftest to find whether shrinker_alloc() is present
or not.
In Linux v6.7, commit c42d50aefd17 ("mm: shrinker: add infrastructure for
dynamically allocating shrinker") added this API.
Bug 4346767
Change-Id: Ida724bb31d3c4db650b3a5742c5972f984cb9152
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028574
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
b0bfc4b801
commit
3b457a1293
3
Makefile
3
Makefile
@@ -83,9 +83,6 @@ subdir-ccflags-y += -DNV_DRM_DEBUGFS_REMOVE_HAS_ROOT_ARGS
|
|||||||
|
|
||||||
# get_file_rcu() have change the argument
|
# get_file_rcu() have change the argument
|
||||||
subdir-ccflags-y += -DNV_GET_FILE_RCU_HAS_PTR_FILE_ARGS
|
subdir-ccflags-y += -DNV_GET_FILE_RCU_HAS_PTR_FILE_ARGS
|
||||||
|
|
||||||
# Support enable to allocate shrinker dynamically
|
|
||||||
subdir-ccflags-y += -DNV_NVMAP_DYNAMIC_SHRINKER_ALLOC_SUPPORT
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
|
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
|
||||||
|
|||||||
@@ -581,7 +581,7 @@ static unsigned long nvmap_page_pool_scan_objects(struct shrinker *shrinker,
|
|||||||
SHRINK_STOP : (sc->nr_to_scan - remaining);
|
SHRINK_STOP : (sc->nr_to_scan - remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NV_NVMAP_DYNAMIC_SHRINKER_ALLOC_SUPPORT)
|
#if defined(NV_SHRINKER_ALLOC_PRESENT) /* Linux 6.7 */
|
||||||
static struct shrinker *nvmap_page_pool_shrinker;
|
static struct shrinker *nvmap_page_pool_shrinker;
|
||||||
#else
|
#else
|
||||||
static struct shrinker nvmap_page_pool_shrinker = {
|
static struct shrinker nvmap_page_pool_shrinker = {
|
||||||
@@ -775,7 +775,7 @@ int nvmap_page_pool_init(struct nvmap_device *dev)
|
|||||||
NULL, "nvmap-bz");
|
NULL, "nvmap-bz");
|
||||||
if (IS_ERR(background_allocator))
|
if (IS_ERR(background_allocator))
|
||||||
goto fail;
|
goto fail;
|
||||||
#if defined(NV_NVMAP_DYNAMIC_SHRINKER_ALLOC_SUPPORT)
|
#if defined(NV_SHRINKER_ALLOC_PRESENT) /* Linux 6.7 */
|
||||||
nvmap_page_pool_shrinker = shrinker_alloc(0, "nvmap_pp_shrinker");
|
nvmap_page_pool_shrinker = shrinker_alloc(0, "nvmap_pp_shrinker");
|
||||||
if (!nvmap_page_pool_shrinker) {
|
if (!nvmap_page_pool_shrinker) {
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -810,7 +810,7 @@ int nvmap_page_pool_fini(struct nvmap_device *dev)
|
|||||||
* registered
|
* registered
|
||||||
*/
|
*/
|
||||||
if (!IS_ERR_OR_NULL(background_allocator)) {
|
if (!IS_ERR_OR_NULL(background_allocator)) {
|
||||||
#if defined(NV_NVMAP_DYNAMIC_SHRINKER_ALLOC_SUPPORT)
|
#if defined(NV_SHRINKER_ALLOC_PRESENT) /* Linux 6.7 */
|
||||||
shrinker_free(nvmap_page_pool_shrinker);
|
shrinker_free(nvmap_page_pool_shrinker);
|
||||||
nvmap_page_pool_shrinker = NULL;
|
nvmap_page_pool_shrinker = NULL;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg
|
||||||
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += shrinker_alloc
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_component_driver_struct_has_non_legacy_dai_naming
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_component_driver_struct_has_non_legacy_dai_naming
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_dai_link_struct_has_c2c_params_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_dai_link_struct_has_c2c_params_arg
|
||||||
|
|||||||
@@ -7021,6 +7021,24 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG" "" "types"
|
compile_check_conftest "$CODE" "NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
shrinker_alloc)
|
||||||
|
#
|
||||||
|
# Determine if the shrinker alloc present or not.
|
||||||
|
#
|
||||||
|
# In Linux v6.7, commit c42d50aefd17 ("mm: shrinker: add infrastructure for
|
||||||
|
# dynamically allocating shrinker")
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/atomic.h>
|
||||||
|
#include <linux/compiler_attributes.h>
|
||||||
|
#include <linux/shrinker.h>
|
||||||
|
void conftest_shrinker_alloc(void) {
|
||||||
|
shrinker_alloc();
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_SHRINKER_ALLOC_PRESENT" "" "functions"
|
||||||
|
;;
|
||||||
|
|
||||||
snd_soc_card_jack_new_has_no_snd_soc_jack_pins)
|
snd_soc_card_jack_new_has_no_snd_soc_jack_pins)
|
||||||
#
|
#
|
||||||
# Determine if the function snd_soc_card_jack_new() has 'pins' and
|
# Determine if the function snd_soc_card_jack_new() has 'pins' and
|
||||||
|
|||||||
Reference in New Issue
Block a user