Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp146242pxb; Fri, 16 Apr 2021 01:48:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybUwTzrT0rQ2zNgeF9y+14FCmuWtPGhK2GiHq7SVs99goV6mpEf3wrwC26Y0CoztAbapQD X-Received: by 2002:a65:5088:: with SMTP id r8mr7104291pgp.434.1618562919787; Fri, 16 Apr 2021 01:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618562919; cv=none; d=google.com; s=arc-20160816; b=CYbyQ8CkUy2VSDnJau85eN97I+lbPPvM/4oL4QMjJ0qdNgHQ1uFbkjhNtfmziw1bqW isXf43Lk7oAJ+JcEpAtpDPUMXanlD4qbEJpalcEdydJtY/Ow84ZFn6fa/r9bENy/pURD EjadYw4kqr8dozbsZoeQgj7+ATJVJYoSbyA8B7XD7odOuZQZe3FhhTGC/3n3wBytPU7F P7fILqWUWJAUgv07Ni52hfU8gUXyEX9+g65q/MXGpCEEXBkQoiulb7/x6C05ne4RcGiP 82Eae6geBdYPL0+TUXA97ePhS3pg0Mn2M8EGDPP4QgwB3BDq6s7ykL+9cAIZmm1ZSrsy AknQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=gAIh4WsVS/ayzhp5HjJe99OkPRqXPu6YrMhzHKnuu4E=; b=Fwz6rsa3TX7N/Il3rXuLiIPnEfCdOHjIyybAVWGchGaPdw1S+24Oi+bAI5vhPKca7h KhUEtEQjr8TyGCmY+ql5lgr2Dy4b+/nCMGj34EYIazVHBnabC85Hb0bT6k3uP52mxEw4 jM8OBP4Olu4inQSvAkADtcDOYPZWPXGaz57ioj254NU13xz/yIVakqKJyRECYCWK8sap cQgHNenn95uGjO02O2Thpgq33U+AxU8H0s1EYtZeKZ3rlOoejGTGTX8umCd8gm/TtdZK g7ZhXeyWKWT1qQMi+Kc7GQ7sFNykcGDAfXTvjiP5zwgsTyvN5ttjiWyjzyZUOGw3PfwZ HGsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="WN/DN/lF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si6298563plo.315.2021.04.16.01.48.27; Fri, 16 Apr 2021 01:48:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="WN/DN/lF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239777AbhDPIgb (ORCPT + 99 others); Fri, 16 Apr 2021 04:36:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54612 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239093AbhDPIga (ORCPT ); Fri, 16 Apr 2021 04:36:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618562166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gAIh4WsVS/ayzhp5HjJe99OkPRqXPu6YrMhzHKnuu4E=; b=WN/DN/lFgtSz2MQF9gvZefpOfOtoSiqDggFsEuNIJHlJzjj3HcwyR+Rgizimoz8dBV1M7y Za08/gB5l5TTJHzxSu5sr6bx/uigrWMac4spP1sJXW77+M9OmkUT0iIAcHWfyq1YajwMGz v8rooabi5h/F/DagGAxm7DoucbuoKvY= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-321-u1nZd45cOEqySIFYD54USQ-1; Fri, 16 Apr 2021 04:36:04 -0400 X-MC-Unique: u1nZd45cOEqySIFYD54USQ-1 Received: by mail-ed1-f72.google.com with SMTP id w15-20020a056402268fb02903828f878ec5so6593331edd.5 for ; Fri, 16 Apr 2021 01:36:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=gAIh4WsVS/ayzhp5HjJe99OkPRqXPu6YrMhzHKnuu4E=; b=BE1+CdI2rh3iv+xslQWpUVDudMPyuVmnI4BsBTRzSzJOyOqv3rlPXTKta/8NfmrvrE gklOn7SLFrW07omdBpSSKKHOHQz5PaBwtLCjEBTg5IO2wnKMP0NPRWjtuYZVg1+NKuPX BK0MdjsWAnrRaKsM7ts1mvf2+JtX1Oa+XMz2XKWcviLGogB1xpdljB7rIXASJbOD/tQC YcftBM8GbwmP5PW5s6fB1P9SYFi7sE2G1FfhQdyQN1QN8duyXydBBehX2S7OHMGqikDJ RZmlwRCr7RSPiDC1eJAa8mEGUPJ1nm/shmZuNMlGzPKxoKNE+0yPJdumoQo5da1sKbxH BKHA== X-Gm-Message-State: AOAM530Z+cKcVjBi+yl+/rVAiCybeEF/nxKbj6H+6DkkdByiegGYxMNJ wttw+yYbQZW+eQd1t4kOUkVjU6/HbwoPDyIyVeudEJO2gDiHMpCyf8aueDrddjieoKvcl9yolDp 4Zrhk74hDJej6oMUkN3DOoI85 X-Received: by 2002:a17:906:2b03:: with SMTP id a3mr7529694ejg.481.1618562162786; Fri, 16 Apr 2021 01:36:02 -0700 (PDT) X-Received: by 2002:a17:906:2b03:: with SMTP id a3mr7529674ejg.481.1618562162630; Fri, 16 Apr 2021 01:36:02 -0700 (PDT) Received: from [192.168.3.132] (p5b0c64fb.dip0.t-ipconnect.de. [91.12.100.251]) by smtp.gmail.com with ESMTPSA id k16sm3764251ejv.37.2021.04.16.01.36.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Apr 2021 01:36:02 -0700 (PDT) Subject: Re: [PATCH v9 6/7] mm: Make alloc_contig_range handle in-use hugetlb pages To: Oscar Salvador , Andrew Morton Cc: Mike Kravetz , Vlastimil Babka , Michal Hocko , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Hocko References: <20210416070023.4742-1-osalvador@suse.de> <20210416070023.4742-7-osalvador@suse.de> From: David Hildenbrand Organization: Red Hat Message-ID: <02de399f-1ecf-98d6-6a78-1301f9a97d5a@redhat.com> Date: Fri, 16 Apr 2021 10:36:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210416070023.4742-7-osalvador@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -int isolate_or_dissolve_huge_page(struct page *page) > +int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) > { > struct hstate *h; > struct page *head; > + int ret = -EBUSY; > > /* > * The page might have been dissolved from under our feet, so make sure > @@ -2373,13 +2380,18 @@ int isolate_or_dissolve_huge_page(struct page *page) > > /* > * Fence off gigantic pages as there is a cyclic dependency between > - * alloc_contig_range and them. Return -ENOME as this has the effect > + * alloc_contig_range and them. Return -ENOMEM as this has the effect Nit: belongs into previous patch. > * of bailing out right away without further retrying. > */ > if (hstate_is_gigantic(h)) > return -ENOMEM; > > - return alloc_and_dissolve_huge_page(h, head); > + if (page_count(head) && isolate_huge_page(head, list)) > + ret = 0; > + else if (!page_count(head)) > + ret = alloc_and_dissolve_huge_page(h, head, list); > + > + return ret; > } > > struct page *alloc_huge_page(struct vm_area_struct *vma, > diff --git a/mm/vmscan.c b/mm/vmscan.c > index bb8321026c0c..5199b9696bab 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -1703,8 +1703,9 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone, > LIST_HEAD(clean_pages); > > list_for_each_entry_safe(page, next, page_list, lru) { > - if (page_is_file_lru(page) && !PageDirty(page) && > - !__PageMovable(page) && !PageUnevictable(page)) { > + if (!PageHuge(page) && page_is_file_lru(page) && > + !PageDirty(page) && !__PageMovable(page) && > + !PageUnevictable(page)) { Nit: adding to the end of the list would require less modifications ;) > ClearPageActive(page); > list_move(&page->lru, &clean_pages); > } > Acked-by: David Hildenbrand -- Thanks, David / dhildenb