Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4052691ybi; Tue, 18 Jun 2019 10:56:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqweMPqYalchhRHvZnXTt9a6v7dXUzT97Tfte3q9pGRQMHqn0GkHN+qQeRE+t/AZmh4pNVxW X-Received: by 2002:a17:902:6b48:: with SMTP id g8mr30490778plt.151.1560880576643; Tue, 18 Jun 2019 10:56:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560880576; cv=none; d=google.com; s=arc-20160816; b=y7wlqLBou8cq2QLHR0D03buhaysjGCsLdPaASoEmT9pUv1ahDeQJ0FE+U25ZztSxHn j1CUZ1umPHtk4y2yIuwjTzm1asPMsJiWPspROP7ggrMQ36bxvMZVo6iksP+z5YtRlleq r2zBLYE3JOFInjJMaN9FfsC/gEylnKFHDR751WLAdjp98STc469s9hjVFMxwDNh1+3kL EsgcSc4ksms6zpRWe36JwOvYTMeiZIm3jKRnG/5ku+ocITkTW8W0TGmsWbVfqgDEr5Ky zN7ugO0H7UcwVtDlimL37niLMQaaOU2v1TsfHwnKOMPSjKcRdgEz2la/w9KBeSXhLQss TGaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=hRFOK+pjnetQHO1VbczYeIM67ED6Qp4/xDYjAsyHg0Y=; b=bJeav7T3HHPkCFQmxUlhJT1VF6F0uWt5yrIHS0O0DtbCGUAOorddNdTT9i/UsAkUg+ DNjxsc4i5HNLqx/T+IcAlUPhUXqSuXUI3wGe7hTeGyPyoDu1HQQWzc6AyWHB2RrSnIyd vLluI9JGBqpy7n+oymfnK7se63ATdC+2/RxuuDGL4cChx8Gm6cuSd67xK9ep0wPD5ucs 87W0XvzfQ+3phSIHkkFvcxq18zVhBNr6tYgsv0nCLYwI3R7G07PVcq5it8nEKJ33+VOk FefOcEJwT8PrDF6WIVihOuWGQk1CTX4fhumgzZTxwRZG/F9EeAPWlY9xREzh3nK1l3EF FveA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=duqFJcbL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j93si13585600plb.32.2019.06.18.10.56.01; Tue, 18 Jun 2019 10:56:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=duqFJcbL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730174AbfFRRzr (ORCPT + 99 others); Tue, 18 Jun 2019 13:55:47 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:43782 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729285AbfFRRzr (ORCPT ); Tue, 18 Jun 2019 13:55:47 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5IHrkdQ192936; Tue, 18 Jun 2019 17:55:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=hRFOK+pjnetQHO1VbczYeIM67ED6Qp4/xDYjAsyHg0Y=; b=duqFJcbLo0ULPOq2ei4bvjgi9cATMVZgQJD+V3y+jt4MrMtO0NaxV9tb3/6PTsmoiaiL JFlD9+CcThW1ctgAMj7UtErFYTYYhYG3KN6rTqpLlHxg3Rmid4wkU6YfW+7a9HBCz9aO yevFg+iwtdJa+B24KFPywrI6D6eopuRC2EmsPfAVKcjRX7toXFnd6pJM3ubnFiguI6s/ PxXUgR/Y8CkEuEhhpNgYDREND86pAfsQ/FKMynBRQnB5CuOQrKTGdQHC7qoM2IfwFP0G JUs49S3k+Xo3jtVc7bHvUq2U5k9KUWCSfPS/Z+IUeySsGSijMWi1zbhl7orlHoKYswa7 xw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2t4rmp60gn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2019 17:55:32 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5IHt79E081741; Tue, 18 Jun 2019 17:55:32 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2t5h5tw6d1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2019 17:55:31 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5IHtTve008642; Tue, 18 Jun 2019 17:55:29 GMT Received: from [192.168.1.222] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Jun 2019 10:55:28 -0700 Subject: Re: [PATCH v3 2/2] mm: hugetlb: soft-offline: dissolve_free_huge_page() return zero on !PageHuge To: Naoya Horiguchi , linux-mm@kvack.org Cc: Andrew Morton , Michal Hocko , xishi.qiuxishi@alibaba-inc.com, "Chen, Jerry T" , "Zhuo, Qiuxu" , linux-kernel@vger.kernel.org, Anshuman Khandual References: <1560761476-4651-1-git-send-email-n-horiguchi@ah.jp.nec.com> <1560761476-4651-3-git-send-email-n-horiguchi@ah.jp.nec.com> From: Mike Kravetz Message-ID: <53844c4d-966e-48d3-f174-b0d3598c180c@oracle.com> Date: Tue, 18 Jun 2019 10:55:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1560761476-4651-3-git-send-email-n-horiguchi@ah.jp.nec.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906180143 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906180143 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/17/19 1:51 AM, Naoya Horiguchi wrote: > madvise(MADV_SOFT_OFFLINE) often returns -EBUSY when calling soft offline > for hugepages with overcommitting enabled. That was caused by the suboptimal > code in current soft-offline code. See the following part: > > ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, > MIGRATE_SYNC, MR_MEMORY_FAILURE); > if (ret) { > ... > } else { > /* > * We set PG_hwpoison only when the migration source hugepage > * was successfully dissolved, because otherwise hwpoisoned > * hugepage remains on free hugepage list, then userspace will > * find it as SIGBUS by allocation failure. That's not expected > * in soft-offlining. > */ > ret = dissolve_free_huge_page(page); > if (!ret) { > if (set_hwpoison_free_buddy_page(page)) > num_poisoned_pages_inc(); > } > } > return ret; > > Here dissolve_free_huge_page() returns -EBUSY if the migration source page > was freed into buddy in migrate_pages(), but even in that case we actually > has a chance that set_hwpoison_free_buddy_page() succeeds. So that means > current code gives up offlining too early now. > > dissolve_free_huge_page() checks that a given hugepage is suitable for > dissolving, where we should return success for !PageHuge() case because > the given hugepage is considered as already dissolved. > > This change also affects other callers of dissolve_free_huge_page(), > which are cleaned up together. > > Reported-by: Chen, Jerry T > Tested-by: Chen, Jerry T > Signed-off-by: Naoya Horiguchi Thanks, Reviewed-by: Mike Kravetz -- Mike Kravetz