video: tegra: nvmap: Remove use of add_mm_counter

add_mm_counter is not an exported function, so instead use
atomic_long_add_return/percpu_counter_add to directly modify RSS stat
counters.

Bug 5222690

Change-Id: I51a68d932aeb04f96e51a4a3c286ee5c8efc789a
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3446982
(cherry picked from commit 8e1a6b2dd1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3453099
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
Tested-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
This commit is contained in:
Ketan Patil
2025-09-05 06:15:02 +00:00
committed by Amulya Yarlagadda
parent cfe6242c8c
commit e488812038
6 changed files with 34 additions and 6 deletions

View File

@@ -134,6 +134,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_mux_add_adapter_has_no_class_argument
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += kthread_complete_and_exit
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mm_struct_struct_has_percpu_counter_rss_stat
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_read_c45
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_write_c45
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size

View File

@@ -7395,6 +7395,23 @@ compile_test() {
compile_check_conftest "$CODE" "NV_MII_BUS_STRUCT_HAS_WRITE_C45" "" "types"
;;
mm_struct_struct_has_percpu_counter_rss_stat)
#
# Determine if the 'rss_stat' member of the 'mm_struct' structure is
# defined with 'percpu_counter'.
#
# This change was made in Linux v6.2 by commit f1a7941243c1 ("mm:
# convert mm's rss stats into percpu_counter2").
#
CODE="
#include <linux/mm_types.h>
void conftest_mm_struct_struct_has_percpu_counter_rss_stat(struct mm_struct *mm) {
percpu_counter_add(&mm->rss_stat[0], 0);
}"
compile_check_conftest "$CODE" "NV_MM_STRUCT_STRUCT_HAS_PERCPU_COUNTER_RSS_STAT" "" "types"
;;
of_property_for_each_u32_removed_internal_args)
#
# Determine if the internal arguments for the macro