linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Rashmica Gupta <rashmica.g@gmail.com>
To: linuxppc-dev@lists.ozlabs.org,
	Anshuman Khandual <khandual@linux.vnet.ibm.com>
Subject: Re: [PATCH 2/2] v1 powerpc/powernv: Enable removal of memory for in memory tracing
Date: Wed, 3 May 2017 16:08:33 +1000	[thread overview]
Message-ID: <9e58fafd-a37c-ac09-debd-ab909d707954@gmail.com> (raw)
In-Reply-To: <1498ebd3-1239-9e5b-847c-920546443638@gmail.com>



On 03/05/17 13:52, Rashmica Gupta wrote:
> On 28/04/17 19:52, Anshuman Khandual wrote:
> ....
>>> +static int check_memblock_online(struct memory_block *mem, void *arg)
>>> +{
>>> +    if (mem->state != MEM_ONLINE)
>>> +        return -1;
>>> +
>>> +    return 0;
>>> +}
>>> +
>>> +static int change_memblock_state(struct memory_block *mem, void *arg)
>>> +{
>>> +    unsigned long state = (unsigned long)arg;
>>> +
>>> +    mem->state = state;
>>> +    return 0;
>>> +}
>>> +
>>> +static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 
>>> nr_pages)
>>> +{
>>> +    u64 end_pfn = start_pfn + nr_pages - 1;
>>> +
>>> +    if (walk_memory_range(start_pfn, end_pfn, NULL,
>>> +        check_memblock_online))
>>> +        return false;
>>> +
>>> +    walk_memory_range(start_pfn, end_pfn, (void *)MEM_GOING_OFFLINE,
>>> +              change_memblock_state);
>>> +
>> walk_memory_range() might be expensive, cant we just change the state
>> to MEM_GOING_OFFLINE while checking the state for MEM_ONLINE during
>> the first loop and bail out if any of the memblock is not in MEM_ONLINE
>> in the first place.
>
> Good idea.
>

This is assuming that it's more likely that the state of memory will be 
MEM_ONLINE rather than anything else (if the state isn't MEM_ONLINE we 
will still have to do a second call of walk_memory_range() to revert the 
state of any memory blocks that we changed). Seems like a reasonable 
assumption to me, thoughts?

  parent reply	other threads:[~2017-05-03  6:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28  5:42 [PATCH 1/2] powerpc/powernv: Add config option for removal of memory Rashmica Gupta
2017-04-28  5:42 ` [PATCH 2/2] v1 powerpc/powernv: Enable removal of memory for in memory tracing Rashmica Gupta
2017-04-28  9:52   ` Anshuman Khandual
2017-05-03  3:52     ` Rashmica Gupta
2017-05-03  6:08       ` Rashmica Gupta
2017-05-03 11:25         ` Anshuman Khandual
2017-05-03  6:08       ` Rashmica Gupta [this message]
2017-05-03 11:56       ` Anshuman Khandual
2017-05-09  7:06         ` Rashmica Gupta
2017-05-14  4:55           ` Anshuman Khandual
2017-05-15  3:34             ` Rashmica Gupta
2017-05-15  4:35               ` Anshuman Khandual
2017-04-28  9:39 ` [PATCH 1/2] powerpc/powernv: Add config option for removal of memory Anshuman Khandual
2017-05-03  3:52   ` Rashmica Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e58fafd-a37c-ac09-debd-ab909d707954@gmail.com \
    --to=rashmica.g@gmail.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).