Commit bfffe79b authored by Chris Metcalf's avatar Chris Metcalf

arch/tile: use proper memparse() for "maxmem" options

This is more standard and avoids having to remember what units
the options actually take.
Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
parent 719ea79e
...@@ -103,13 +103,11 @@ unsigned long __initdata pci_reserve_end_pfn = -1U; ...@@ -103,13 +103,11 @@ unsigned long __initdata pci_reserve_end_pfn = -1U;
static int __init setup_maxmem(char *str) static int __init setup_maxmem(char *str)
{ {
long maxmem_mb; unsigned long long maxmem;
if (str == NULL || strict_strtol(str, 0, &maxmem_mb) != 0 || if (str == NULL || (maxmem = memparse(str, NULL)) == 0)
maxmem_mb == 0)
return -EINVAL; return -EINVAL;
maxmem_pfn = (maxmem_mb >> (HPAGE_SHIFT - 20)) << maxmem_pfn = (maxmem >> HPAGE_SHIFT) << (HPAGE_SHIFT - PAGE_SHIFT);
(HPAGE_SHIFT - PAGE_SHIFT);
pr_info("Forcing RAM used to no more than %dMB\n", pr_info("Forcing RAM used to no more than %dMB\n",
maxmem_pfn >> (20 - PAGE_SHIFT)); maxmem_pfn >> (20 - PAGE_SHIFT));
return 0; return 0;
...@@ -119,14 +117,15 @@ early_param("maxmem", setup_maxmem); ...@@ -119,14 +117,15 @@ early_param("maxmem", setup_maxmem);
static int __init setup_maxnodemem(char *str) static int __init setup_maxnodemem(char *str)
{ {
char *endp; char *endp;
long maxnodemem_mb, node; unsigned long long maxnodemem;
long node;
node = str ? simple_strtoul(str, &endp, 0) : INT_MAX; node = str ? simple_strtoul(str, &endp, 0) : INT_MAX;
if (node >= MAX_NUMNODES || *endp != ':' || if (node >= MAX_NUMNODES || *endp != ':')
strict_strtol(endp+1, 0, &maxnodemem_mb) != 0)
return -EINVAL; return -EINVAL;
maxnodemem_pfn[node] = (maxnodemem_mb >> (HPAGE_SHIFT - 20)) << maxnodemem = memparse(endp+1, NULL);
maxnodemem_pfn[node] = (maxnodemem >> HPAGE_SHIFT) <<
(HPAGE_SHIFT - PAGE_SHIFT); (HPAGE_SHIFT - PAGE_SHIFT);
pr_info("Forcing RAM used on node %ld to no more than %dMB\n", pr_info("Forcing RAM used on node %ld to no more than %dMB\n",
node, maxnodemem_pfn[node] >> (20 - PAGE_SHIFT)); node, maxnodemem_pfn[node] >> (20 - PAGE_SHIFT));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment