Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933828AbbHLI5K (ORCPT ); Wed, 12 Aug 2015 04:57:10 -0400 Received: from TYO201.gate.nec.co.jp ([210.143.35.51]:50156 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753425AbbHLI5C convert rfc822-to-8bit (ORCPT ); Wed, 12 Aug 2015 04:57:02 -0400 From: Naoya Horiguchi To: Wanpeng Li CC: Andrew Morton , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 5/5] mm/hwpoison: replace most of put_page in memory error handling by put_hwpoison_page Thread-Topic: [PATCH v2 5/5] mm/hwpoison: replace most of put_page in memory error handling by put_hwpoison_page Thread-Index: AQHQ02OZcYX2cAnHZUK9AvcajrKVSp4He5qA Date: Wed, 12 Aug 2015 08:55:26 +0000 Message-ID: <20150812085525.GD32192@hori1.linux.bs1.fc.nec.co.jp> References: <1439206103-86829-1-git-send-email-wanpeng.li@hotmail.com> In-Reply-To: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.128.101.24] Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <843CC0B960D5994BBFBAE8B5AC12A0CB@gisp.nec.co.jp> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1763 Lines: 42 On Mon, Aug 10, 2015 at 07:28:23PM +0800, Wanpeng Li wrote: > Replace most of put_page in memory error handling by put_hwpoison_page, > except the ones at the front of soft_offline_page since the page maybe > THP page and the get refcount in madvise_hwpoison is against the single > 4KB page instead of the logic in get_hwpoison_page. > > Signed-off-by: Wanpeng Li # Sorry for my late response. If I read correctly, get_user_pages_fast() (called by madvise_hwpoison) for a THP tail page takes a refcount from each of head and tail page. gup_huge_pmd() does this in the fast path, and get_page_foll() does this in the slow path (maybe via the following code path) get_user_pages_unlocked __get_user_pages_unlocked __get_user_pages_locked __get_user_pages follow_page_mask follow_trans_huge_pmd (with FOLL_GET set) get_page_foll So this should be equivalent to what get_hwpoison_page() does for thp pages with regard to refcounting. And I'm expecting that a refcount taken by get_hwpoison_page() is released by put_hwpoison_page() even if the page's status is changed during error handling (the typical (or only?) case is successful thp split.) So I think you can apply put_hwpoison_page() for 3 more callsites in mm/memory-failure.c. - MF_MSG_POISONED_HUGE case - "soft offline: %#lx page already poisoned" case (you mentioned above) - "soft offline: %#lx: failed to split THP" case (you mentioned above) Thanks, Naoya Horiguchi-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/