mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: Allow comptag to deduct occupied memory by the system
The comptag allocates memory based on the available total RAM, which theoretically should be the MAX physical RAM size however practically should deduct the part being taken by the running system. Otherwise, the taken memory part will never get used and wasted. This change adds a comptag_mem_deduct to each platform and to allow them to assign the deductible value based on their own use cases so as to save memory. Bug 2327574 Bug 2284925 Change-Id: I124e20a66183c22723c34a7ec6ce34832c12f02e Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1804157 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
06f54be8c9
commit
19cd7ffb5d
@@ -93,11 +93,20 @@ static void nvgpu_init_vars(struct gk20a *g)
|
|||||||
|
|
||||||
static void nvgpu_init_gr_vars(struct gk20a *g)
|
static void nvgpu_init_gr_vars(struct gk20a *g)
|
||||||
{
|
{
|
||||||
|
struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g));
|
||||||
gk20a_init_gr(g);
|
gk20a_init_gr(g);
|
||||||
|
|
||||||
nvgpu_log_info(g, "total ram pages : %lu", totalram_pages);
|
nvgpu_log_info(g, "total ram pages : %lu", totalram_pages);
|
||||||
g->gr.max_comptag_mem = totalram_pages
|
g->gr.max_comptag_mem = totalram_pages
|
||||||
>> (10 - (PAGE_SHIFT - 10));
|
>> (10 - (PAGE_SHIFT - 10));
|
||||||
|
|
||||||
|
/* Deduct the part taken by the running system */
|
||||||
|
if (platform->comptag_mem_deduct &&
|
||||||
|
g->gr.max_comptag_mem > platform->comptag_mem_deduct) {
|
||||||
|
g->gr.max_comptag_mem -= platform->comptag_mem_deduct;
|
||||||
|
nvgpu_log_info(g, "deducted max memory for comptag: %u",
|
||||||
|
g->gr.max_comptag_mem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvgpu_init_timeout(struct gk20a *g)
|
static void nvgpu_init_timeout(struct gk20a *g)
|
||||||
|
|||||||
@@ -272,6 +272,12 @@ struct gk20a_platform {
|
|||||||
/* stream id to use */
|
/* stream id to use */
|
||||||
u32 ltc_streamid;
|
u32 ltc_streamid;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The deductible memory size for max_comptag_mem (in MBytes)
|
||||||
|
* Usually close to memory size that running system is taking
|
||||||
|
*/
|
||||||
|
u32 comptag_mem_deduct;
|
||||||
|
|
||||||
/* scaling rate */
|
/* scaling rate */
|
||||||
unsigned long cached_rate;
|
unsigned long cached_rate;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user