From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756495AbbKDXku (ORCPT ); Wed, 4 Nov 2015 18:40:50 -0500 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:44682 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756229AbbKDXks (ORCPT ); Wed, 4 Nov 2015 18:40:48 -0500 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 165.244.98.150 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.223.161 X-Original-MAILFROM: minchan@kernel.org Date: Thu, 5 Nov 2015 08:40:55 +0900 From: Minchan Kim To: Sergey Senozhatsky CC: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michael Kerrisk , linux-api@vger.kernel.org, Hugh Dickins , Johannes Weiner , Rik van Riel , Mel Gorman , KOSAKI Motohiro , Jason Evans , Daniel Micay , "Kirill A. Shutemov" , Shaohua Li , Michal Hocko , yalin.wang2010@gmail.com Subject: Re: [PATCH v2 01/13] mm: support madvise(MADV_FREE) Message-ID: <20151104234055.GB7357@bbox> References: <1446600367-7976-1-git-send-email-minchan@kernel.org> <1446600367-7976-2-git-send-email-minchan@kernel.org> <20151104022951.GA3744@swordfish> MIME-Version: 1.0 In-Reply-To: <20151104022951.GA3744@swordfish> User-Agent: Mutt/1.5.21 (2010-09-15) X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB07/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2015/11/05 08:40:45, Serialize by Router on LGEKRMHUB07/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2015/11/05 08:40:45, Serialize complete at 2015/11/05 08:40:45 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 04, 2015 at 11:29:51AM +0900, Sergey Senozhatsky wrote: > On (11/04/15 10:25), Minchan Kim wrote: > [..] > > +static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, > > + unsigned long end, struct mm_walk *walk) > > + > > +{ > > + struct mmu_gather *tlb = walk->private; > > + struct mm_struct *mm = tlb->mm; > > + struct vm_area_struct *vma = walk->vma; > > + spinlock_t *ptl; > > + pte_t *pte, ptent; > > + struct page *page; > > > I'll just ask (probably I'm missing something) > > + pmd_trans_huge_lock() ? No. It would be deadlock. > > > + split_huge_page_pmd(vma, addr, pmd); > > + if (pmd_trans_unstable(pmd)) > > + return 0; > > + > > + pte = pte_offset_map_lock(mm, pmd, addr, &ptl); > > + arch_enter_lazy_mmu_mode(); > > + for (; addr != end; pte++, addr += PAGE_SIZE) { > > + ptent = *pte; > > + > > + if (!pte_present(ptent)) > > + continue; > > + > > + page = vm_normal_page(vma, addr, ptent); > > + if (!page) > > + continue; > > + > > -ss > > -- > 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: Minchan Kim Subject: Re: [PATCH v2 01/13] mm: support madvise(MADV_FREE) Date: Thu, 5 Nov 2015 08:40:55 +0900 Message-ID: <20151104234055.GB7357@bbox> References: <1446600367-7976-1-git-send-email-minchan@kernel.org> <1446600367-7976-2-git-send-email-minchan@kernel.org> <20151104022951.GA3744@swordfish> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: In-Reply-To: <20151104022951.GA3744@swordfish> Content-Disposition: inline Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Sergey Senozhatsky Cc: Andrew Morton , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Michael Kerrisk , linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Hugh Dickins , Johannes Weiner , Rik van Riel , Mel Gorman , KOSAKI Motohiro , Jason Evans , Daniel Micay , "Kirill A. Shutemov" , Shaohua Li , Michal Hocko , yalin.wang2010-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org List-Id: linux-api@vger.kernel.org On Wed, Nov 04, 2015 at 11:29:51AM +0900, Sergey Senozhatsky wrote: > On (11/04/15 10:25), Minchan Kim wrote: > [..] > > +static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, > > + unsigned long end, struct mm_walk *walk) > > + > > +{ > > + struct mmu_gather *tlb = walk->private; > > + struct mm_struct *mm = tlb->mm; > > + struct vm_area_struct *vma = walk->vma; > > + spinlock_t *ptl; > > + pte_t *pte, ptent; > > + struct page *page; > > > I'll just ask (probably I'm missing something) > > + pmd_trans_huge_lock() ? No. It would be deadlock. > > > + split_huge_page_pmd(vma, addr, pmd); > > + if (pmd_trans_unstable(pmd)) > > + return 0; > > + > > + pte = pte_offset_map_lock(mm, pmd, addr, &ptl); > > + arch_enter_lazy_mmu_mode(); > > + for (; addr != end; pte++, addr += PAGE_SIZE) { > > + ptent = *pte; > > + > > + if (!pte_present(ptent)) > > + continue; > > + > > + page = vm_normal_page(vma, addr, ptent); > > + if (!page) > > + continue; > > + > > -ss > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo-Bw31MaZKKs0EbZ0PF+XxCw@public.gmane.org For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by kanga.kvack.org (Postfix) with ESMTP id 09F9982F64 for ; Wed, 4 Nov 2015 18:40:51 -0500 (EST) Received: by pabfh17 with SMTP id fh17so66927581pab.0 for ; Wed, 04 Nov 2015 15:40:50 -0800 (PST) Received: from lgeamrelo11.lge.com (LGEAMRELO11.lge.com. [156.147.23.51]) by mx.google.com with ESMTPS id rr3si5351805pbc.240.2015.11.04.15.40.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Nov 2015 15:40:50 -0800 (PST) Date: Thu, 5 Nov 2015 08:40:55 +0900 From: Minchan Kim Subject: Re: [PATCH v2 01/13] mm: support madvise(MADV_FREE) Message-ID: <20151104234055.GB7357@bbox> References: <1446600367-7976-1-git-send-email-minchan@kernel.org> <1446600367-7976-2-git-send-email-minchan@kernel.org> <20151104022951.GA3744@swordfish> MIME-Version: 1.0 In-Reply-To: <20151104022951.GA3744@swordfish> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Sender: owner-linux-mm@kvack.org List-ID: To: Sergey Senozhatsky Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michael Kerrisk , linux-api@vger.kernel.org, Hugh Dickins , Johannes Weiner , Rik van Riel , Mel Gorman , KOSAKI Motohiro , Jason Evans , Daniel Micay , "Kirill A. Shutemov" , Shaohua Li , Michal Hocko , yalin.wang2010@gmail.com On Wed, Nov 04, 2015 at 11:29:51AM +0900, Sergey Senozhatsky wrote: > On (11/04/15 10:25), Minchan Kim wrote: > [..] > > +static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, > > + unsigned long end, struct mm_walk *walk) > > + > > +{ > > + struct mmu_gather *tlb = walk->private; > > + struct mm_struct *mm = tlb->mm; > > + struct vm_area_struct *vma = walk->vma; > > + spinlock_t *ptl; > > + pte_t *pte, ptent; > > + struct page *page; > > > I'll just ask (probably I'm missing something) > > + pmd_trans_huge_lock() ? No. It would be deadlock. > > > + split_huge_page_pmd(vma, addr, pmd); > > + if (pmd_trans_unstable(pmd)) > > + return 0; > > + > > + pte = pte_offset_map_lock(mm, pmd, addr, &ptl); > > + arch_enter_lazy_mmu_mode(); > > + for (; addr != end; pte++, addr += PAGE_SIZE) { > > + ptent = *pte; > > + > > + if (!pte_present(ptent)) > > + continue; > > + > > + page = vm_normal_page(vma, addr, ptent); > > + if (!page) > > + continue; > > + > > -ss > > -- > 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: email@kvack.org -- 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: email@kvack.org