Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175710
b: refs/heads/master
c: 8be8cf5
h: refs/heads/master
v: v3
  • Loading branch information
Brian King authored and Benjamin Herrenschmidt committed Oct 30, 2009
1 parent 01ffc36 commit 437b92f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6cff46f4bc6cc4a8a4154b0b6a2e669db08e8fd2
refs/heads/master: 8be8cf5b47f72096e42bf88cc3afff7a942a346c
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/platforms/pseries/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ config PPC_SMLPAR

config CMM
tristate "Collaborative memory management"
depends on PPC_SMLPAR && !CRASH_DUMP
depends on PPC_SMLPAR
default y
help
Select this option, if you want to enable the kernel interface
Expand Down
29 changes: 19 additions & 10 deletions trunk/arch/powerpc/platforms/pseries/cmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,26 +229,35 @@ static void cmm_get_mpp(void)
{
int rc;
struct hvcall_mpp_data mpp_data;
unsigned long active_pages_target;
signed long page_loan_request;
signed long active_pages_target, page_loan_request, target;
signed long total_pages = totalram_pages + loaned_pages;
signed long min_mem_pages = (min_mem_mb * 1024 * 1024) / PAGE_SIZE;

rc = h_get_mpp(&mpp_data);

if (rc != H_SUCCESS)
return;

page_loan_request = div_s64((s64)mpp_data.loan_request, PAGE_SIZE);
loaned_pages_target = page_loan_request + loaned_pages;
if (loaned_pages_target > oom_freed_pages)
loaned_pages_target -= oom_freed_pages;
target = page_loan_request + (signed long)loaned_pages;

if (target < 0 || total_pages < min_mem_pages)
target = 0;

if (target > oom_freed_pages)
target -= oom_freed_pages;
else
loaned_pages_target = 0;
target = 0;

active_pages_target = total_pages - target;

if (min_mem_pages > active_pages_target)
target = total_pages - min_mem_pages;

active_pages_target = totalram_pages + loaned_pages - loaned_pages_target;
if (target < 0)
target = 0;

if ((min_mem_mb * 1024 * 1024) > (active_pages_target * PAGE_SIZE))
loaned_pages_target = totalram_pages + loaned_pages -
((min_mem_mb * 1024 * 1024) / PAGE_SIZE);
loaned_pages_target = target;

cmm_dbg("delta = %ld, loaned = %lu, target = %lu, oom = %lu, totalram = %lu\n",
page_loan_request, loaned_pages, loaned_pages_target,
Expand Down

0 comments on commit 437b92f

Please sign in to comment.