linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
To: Michal Hocko <mhocko@kernel.org>, Dave Hansen <dave.hansen@intel.com>
Cc: pbonzini@redhat.com, akpm@linux-foundation.org,
	dan.j.williams@intel.com, gleb@kernel.org, mtosatti@redhat.com,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	stefanha@redhat.com, yuhuang@redhat.com, linux-mm@kvack.org,
	ross.zwisler@linux.intel.com, Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps
Date: Tue, 13 Sep 2016 11:01:09 +0800	[thread overview]
Message-ID: <a244d7f9-762e-6f26-a537-0524765c6815@linux.intel.com> (raw)
In-Reply-To: <20160912191035.GD14997@dhcp22.suse.cz>



On 09/13/2016 03:10 AM, Michal Hocko wrote:
> On Mon 12-09-16 08:01:06, Dave Hansen wrote:
>> On 09/12/2016 05:54 AM, Michal Hocko wrote:
>>>>> In order to fix this bug, we make 'file->version' indicate the end address
>>>>> of current VMA
>>> Doesn't this open doors to another weird cases. Say B would be partially
>>> unmapped (tail of the VMA would get unmapped and reused for a new VMA.
>>
>> In the end, this interface isn't about VMAs.  It's about addresses, and
>> we need to make sure that the _addresses_ coming out of it are sane.  In
>> the case that a VMA was partially unmapped, it doesn't make sense to
>> show the "new" VMA because we already had some output covering the
>> address of the "new" VMA from the old one.
>
> OK, that is a fair point and it speaks for caching the vm_end rather
> than vm_start+skip.
>
>>> I am not sure we provide any guarantee when there are more read
>>> syscalls. Hmm, even with a single read() we can get inconsistent results
>>> from different threads without any user space synchronization.
>>
>> Yeah, very true.  But, I think we _can_ at least provide the following
>> guarantees (among others):
>> 1. addresses don't go backwards
>> 2. If there is something at a given vaddr during the entirety of the
>>    life of the smaps walk, we will produce some output for it.
>
> I guess we also want
>   3. no overlaps with previously printed values (assuming two subsequent
>      reads without seek).
>
> the patch tries to achieve the last part as well AFAICS but I guess this
> is incomplete because at least /proc/<pid>/smaps will report counters
> for the full vma range while the header (aka show_map_vma) will report
> shorter (non-overlapping) range. I haven't checked other files which use
> m_{start,next}

You are right. Will fix both /proc/PID/smaps and /proc/PID/maps in
the next version.

>
> Considering how this all can be tricky and how partial reads can be
> confusing and even misleading I am really wondering whether we
> should simply document that only full reads will provide a sensible
> results.

Make sense. Will document the guarantee in
Documentation/filesystems/proc.txt

Thank you, Dave and Michal, for figuring out the right direction. :)


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-09-13  3:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12  3:12 Xiao Guangrong
2016-09-12 12:54 ` Michal Hocko
2016-09-12 15:01   ` Dave Hansen
2016-09-12 19:10     ` Michal Hocko
2016-09-13  3:01       ` Xiao Guangrong [this message]
2016-09-13 14:59       ` Oleg Nesterov
2016-09-13 16:21         ` Dave Hansen
2016-09-14 15:38           ` Oleg Nesterov
2016-09-19  7:21             ` Xiao Guangrong

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=a244d7f9-762e-6f26-a537-0524765c6815@linux.intel.com \
    --to=guangrong.xiao@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=oleg@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=ross.zwisler@linux.intel.com \
    --cc=stefanha@redhat.com \
    --cc=yuhuang@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox