All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: Rashmica Gupta <rashmicy@gmail.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/2] v1 powerpc/powernv: Enable removal of memory for in memory tracing
Date: Wed, 3 May 2017 16:55:38 +0530	[thread overview]
Message-ID: <6d200f03-b6bb-b97a-220d-5472d6071aa6@linux.vnet.ibm.com> (raw)
In-Reply-To: <94710510-15a7-baf3-1626-7736785a71aa@gmail.com>

On 05/03/2017 11:38 AM, Rashmica Gupta wrote:
> 
> 
> 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?

Revert the state of memory blocks that we changed till the point we
discover that something is not MEM_ONLINE and when we decide to abort.
In that case we have to remember all the changes we have done till
that point for us to revert back. Lets keep it as it is.

  reply	other threads:[~2017-05-03 11:26 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 [this message]
2017-05-03  6:08       ` Rashmica Gupta
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=6d200f03-b6bb-b97a-220d-5472d6071aa6@linux.vnet.ibm.com \
    --to=khandual@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=rashmicy@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.