From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752471AbbB1D03 (ORCPT ); Fri, 27 Feb 2015 22:26:29 -0500 Received: from mail113-250.mail.alibaba.com ([205.204.113.250]:54850 "EHLO us-alimail-mta1.hst.scl.en.alidc.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751111AbbB1D02 (ORCPT ); Fri, 27 Feb 2015 22:26:28 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R361e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=r46d02013;MF=hillf.zj@alibaba-inc.com;PH=DS;RN=7;RT=7;SR=0; Reply-To: "Hillf Danton" From: "Hillf Danton" To: "'Mike Kravetz'" Cc: "linux-kernel" , , "Andrew Morton" , , "'Aneesh Kumar'" , "'Joonsoo Kim'" Subject: Re: [RFC 2/3] hugetlbfs: coordinate global and subpool reserve accounting Date: Sat, 28 Feb 2015 11:25:24 +0800 Message-ID: <013001d05306$31c8b250$955a16f0$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AdBTBfGThUet3/d+QNOXnbU7zg/uuQ== Content-Language: zh-cn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > @@ -3444,10 +3445,14 @@ int hugetlb_reserve_pages(struct inode *inode, > * Check enough hugepages are available for the reservation. > * Hand the pages back to the subpool if there are not > */ Better if comment is updated correspondingly. Hillf > - ret = hugetlb_acct_memory(h, chg); > - if (ret < 0) { > - hugepage_subpool_put_pages(spool, chg); > - goto out_err; > + if (subpool_reserved(spool)) > + ret = 0; > + else { > + ret = hugetlb_acct_memory(h, chg); > + if (ret < 0) { > + hugepage_subpool_put_pages(spool, chg); > + goto out_err; > + } > } >