From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754117AbcFPKRt (ORCPT ); Thu, 16 Jun 2016 06:17:49 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36048 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751619AbcFPKRs (ORCPT ); Thu, 16 Jun 2016 06:17:48 -0400 Date: Thu, 16 Jun 2016 13:17:44 +0300 From: "Kirill A. Shutemov" To: Hillf Danton Cc: "Kirill A. Shutemov" , linux-kernel , linux-mm@kvack.org Subject: Re: [PATCHv9-rebased2 11/37] mm: introduce do_set_pmd() Message-ID: <20160616101744.GC18137@node.shutemov.name> References: <050201d1c7ae$9dbf9370$d93eba50$@alibaba-inc.com> <050301d1c7af$9cbe81b0$d63b8510$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <050301d1c7af$9cbe81b0$d63b8510$@alibaba-inc.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 16, 2016 at 05:15:22PM +0800, Hillf Danton wrote: > > + > > +static int do_set_pmd(struct fault_env *fe, struct page *page) > > +{ > > + struct vm_area_struct *vma = fe->vma; > > + bool write = fe->flags & FAULT_FLAG_WRITE; > > + unsigned long haddr = fe->address & HPAGE_PMD_MASK; > > + pmd_t entry; > > + int i, ret; > > + > > + if (!transhuge_vma_suitable(vma, haddr)) > > + return VM_FAULT_FALLBACK; > > + > > + ret = VM_FAULT_FALLBACK; > > + page = compound_head(page); > > + > > + fe->ptl = pmd_lock(vma->vm_mm, fe->pmd); > > + if (unlikely(!pmd_none(*fe->pmd))) > > + goto out; > > Can we reply to the caller that fault is handled correctly(by > resetting ret to zero before jump)? It's non necessary handled. It's handled only if the pmd if huge. If it points to pte table, we need to check relevant pte entry. If pmd is huge it will caught by pte_alloc_one_map() later. -- Kirill A. Shutemov