[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM_iQpXNpZC+2Fs4Gjm13qHDtL_Nk_BwOH5xg+bp65QE8=Pfng@mail.gmail.com>
Date: Fri, 4 Aug 2017 11:06:03 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>, "# .39.x" <stable@...nel.org>,
Hugh Dickins <hughd@...gle.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: [PATCH] mm: fix list corruptions on shmem shrinklist
On Thu, Aug 3, 2017 at 4:25 PM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
> On Thu, Aug 3, 2017 at 4:11 PM, Andrew Morton <akpm@...ux-foundation.org> wrote:
>>
>> Where is this INIT_LIST_HEAD()?
>
> I think it's this one:
>
> list_del_init(&info->shrinklist);
>
> in shmem_unused_huge_shrink().
Yes, this is correct. Sorry about confusion.
>
>> I'm not sure I'm understanding this. AFAICT all the list operations to
>> which you refer are synchronized under spin_lock(&sbinfo->shrinklist_lock)?
>
> No, notice how shmem_unused_huge_shrink() does the
>
> list_move(&info->shrinklist, &to_remove);
>
> and
>
> list_move(&info->shrinklist, &list);
>
> to move to (two different) private lists under the shrinklist_lock,
> but once it is on that private "list/to_remove" list, it is then
> accessed outside the locked region.
>
> Honestly, I don't love this situation, or the patch, but I think the
> patch is likely the right thing to do.
>
Me neither. This is probably the quickest fix we could have,
other possible changes might need much more work.
Thanks.
Powered by blists - more mailing lists