Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752061AbdDUEb2 (ORCPT ); Fri, 21 Apr 2017 00:31:28 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60582 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751537AbdDUEb0 (ORCPT ); Fri, 21 Apr 2017 00:31:26 -0400 Subject: Re: [PATCH v5 03/11] mm: thp: introduce separate TTU flag for thp freezing To: Zi Yan , n-horiguchi@ah.jp.nec.com, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20170420204752.79703-1-zi.yan@sent.com> <20170420204752.79703-4-zi.yan@sent.com> Cc: akpm@linux-foundation.org, minchan@kernel.org, vbabka@suse.cz, mgorman@techsingularity.net, mhocko@kernel.org, khandual@linux.vnet.ibm.com, zi.yan@cs.rutgers.edu, dnellans@nvidia.com From: Anshuman Khandual Date: Fri, 21 Apr 2017 09:59:43 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170420204752.79703-4-zi.yan@sent.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 17042104-0052-0000-0000-00000230CCD7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042104-0053-0000-0000-0000080B1E0A Message-Id: <4806dc43-c416-cdb4-f4b5-60553afae036@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-21_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704210083 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1890 Lines: 48 On 04/21/2017 02:17 AM, Zi Yan wrote: > From: Naoya Horiguchi > > TTU_MIGRATION is used to convert pte into migration entry until thp split > completes. This behavior conflicts with thp migration added later patches, > so let's introduce a new TTU flag specifically for freezing. > > try_to_unmap() is used both for thp split (via freeze_page()) and page > migration (via __unmap_and_move()). In freeze_page(), ttu_flag given for > head page is like below (assuming anonymous thp): > > (TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | TTU_RMAP_LOCKED | \ > TTU_MIGRATION | TTU_SPLIT_HUGE_PMD) > > and ttu_flag given for tail pages is: > > (TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | TTU_RMAP_LOCKED | \ > TTU_MIGRATION) > > __unmap_and_move() calls try_to_unmap() with ttu_flag: > > (TTU_MIGRATION | TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS) > > Now I'm trying to insert a branch for thp migration at the top of > try_to_unmap_one() like below > > static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, > unsigned long address, void *arg) > { > ... > if (flags & TTU_MIGRATION) { > if (!pvmw.pte && page) { > set_pmd_migration_entry(&pvmw, page); > continue; > } > } > > , so try_to_unmap() for tail pages called by thp split can go into thp > migration code path (which converts *pmd* into migration entry), while > the expectation is to freeze thp (which converts *pte* into migration entry.) > > I detected this failure as a "bad page state" error in a testcase where > split_huge_page() is called from queue_pages_pte_range(). > > Signed-off-by: Naoya Horiguchi It had Kirril's acked-by (https://patchwork.kernel.org/patch/9416221/) last time around. Please include again.