Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262718AbTIQUye (ORCPT ); Wed, 17 Sep 2003 16:54:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262756AbTIQUye (ORCPT ); Wed, 17 Sep 2003 16:54:34 -0400 Received: from hermes.py.intel.com ([146.152.216.3]:46577 "EHLO hermes.py.intel.com") by vger.kernel.org with ESMTP id S262718AbTIQUy2 (ORCPT ); Wed, 17 Sep 2003 16:54:28 -0400 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C37D5D.E0DBF4BA" X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 Subject: Hugetlb FS quota problem Date: Wed, 17 Sep 2003 13:54:25 -0700 Message-ID: <41F331DBE1178346A6F30D7CF124B24B0183C1F5@fmsmsx409.fm.intel.com> X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: Hugetlb FS quota problem Thread-Index: AcN9XeDKdzso6OwmQWePjvFrVJxyBQ== From: "Chen, Kenneth W" To: X-OriginalArrivalTime: 17 Sep 2003 20:54:26.0380 (UTC) FILETIME=[E16AA8C0:01C37D5D] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7957 Lines: 121 This is a multi-part message in MIME format. ------_=_NextPart_001_01C37D5D.E0DBF4BA Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable We found a problem in hugetlbfs file system quota when using huge page via mmap. The mmap method in hugetlbfs_file_operation always takes quota for every mmap even for pages that are already allocated on that inode. This results in taxing the same hugepage multiple times and causing mmap to fail on existing file when quota mistakenly runs out. The following patch against 2.6.0-test5 fix the problem. =20 <>=20 ------_=_NextPart_001_01C37D5D.E0DBF4BA Content-Type: application/octet-stream; name="htlbfs_quota.patch" Content-Transfer-Encoding: base64 Content-Description: htlbfs_quota.patch Content-Disposition: attachment; filename="htlbfs_quota.patch" ZGlmZiAtdXJ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mluZm8gPQ0KKwkJSFVHRVRMQkZTX1NCKG1hcHBpbmctPmhvc3Qt Pmlfc2IpOw0KKw0KKwlpZiAoc2JpbmZvLT5mcmVlX2Jsb2NrcyA+IC0xKSB7DQorCQlzcGluX2xv Y2soJnNiaW5mby0+c3RhdF9sb2NrKTsNCisJCXNiaW5mby0+ZnJlZV9ibG9ja3MrKzsNCisJCXNw aW5fdW5sb2NrKCZzYmluZm8tPnN0YXRfbG9jayk7DQorCX0NCit9DQorDQogI2RlZmluZSBQU0VV RE9fRElSRU5UX1NJWkUJMjANCiANCiBleHRlcm4gc3RydWN0IGZpbGVfb3BlcmF0aW9ucyBodWdl dGxiZnNfZmlsZV9vcGVyYXRpb25zOw0K ------_=_NextPart_001_01C37D5D.E0DBF4BA-- - 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/