Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932633AbcJLJKS (ORCPT ); Wed, 12 Oct 2016 05:10:18 -0400 Received: from mail-co1nam03on0042.outbound.protection.outlook.com ([104.47.40.42]:2248 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932105AbcJLJKH (ORCPT ); Wed, 12 Oct 2016 05:10:07 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christian.Koenig@amd.com; Subject: Re: [RFC 0/6] Module for tracking/accounting shared memory buffers To: Ruchi Kandoi , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <1476229810-26570-1-git-send-email-kandoiruchi@google.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Wed, 12 Oct 2016 11:09:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1476229810-26570-1-git-send-email-kandoiruchi@google.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [2a02:908:1251:7981:a462:f0a8:bb07:e87a] X-ClientProxiedBy: AM3PR08CA0020.eurprd08.prod.outlook.com (10.160.207.158) To BN6PR12MB1298.namprd12.prod.outlook.com (10.168.227.148) X-MS-Office365-Filtering-Correlation-Id: ab531813-695b-44ac-c47a-08d3f27f8d7c X-Microsoft-Exchange-Diagnostics: 1;BN6PR12MB1298;2:jliRnLmOV4hy3CBZLqsCKh+E/L5v1zaUS5GVrdzoFv/RaWW6VvkU7O9zA6YURu+bcPAxP6PXYZ0KEzBsTvYrSA2co4R91DCBMMyXwxdru7VKxqYbeJbk1szOkqQcdlZ7gEJt1cA46gZdDyaRtm9nkmJ861LUiBRJdCy32m0+c9GAoZfy/cRKZIPjUznwVcjk/K5WFd3zUniCuL3ePbl/DQ==;3:tCew7BNZyQz3+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MB1298;31:rfr7z7GwERE6mQ9JDLBkjw9KFe5FhdFx8mpQeexkQWeZ7PzmwYbZXhVe/Bkuhmfv6Zpbq6M6KG0dDvETs/U5au4vWKasUX3i78OGJEsL5tc9PpY947iO51XGiUivnWxG/CoRhkhkhHlFnA++xOq3pU4dMKHUJwneAHb0YFZVcDSvlC5Us8BeiqDzG9RW1TOMVaE8svJSnMpb5c4LxTDxEUrRPXsIAmoxMaclMwKuqKdO8tyLZc45yT+tFXD3zApl;20:xz9uwuX5vMB6S4x1ILD7+yLXdRG1//jUKUTH3yfOVhAGjcZpyK32s5S9SZBgS3+R7wfPP14gqgbUUJf8jepYmM24SrPXDizgkmRF1rpqT9dFAMeBKA02yXaPRUAcZBB1EYGUtcPnrNUV7mOwr11W15BXLQZhXKrzgf8aIv+nkQSiueyOpse9xaUZxNVj4qVqgBmjyeMl3ZC15kb8flYv1I6BoGwo8RfatBczVEHmhKjr/6b2akFNmIEjiCfJhQNXViN4foe6U7wUCluZksXLOgFkK4jJVeTQxnOXRbgjsZt0LYtUmiH8j5H+1E7Mt8OOdfW9ehaAy8yS3BJQtiQs8e/ATsZSXrncDPLLSmGKV422EteWR/VCJmmvuKD0nnWYbMylC+twolz2uFvf25j0IwGWuvGeiD6Bfk17JYRfGAU1zdwGlVMCSAfpZWVPLnYbXdITyjGKR0QF1Gp/7dUIxlSjjFXnVKPUphICW2GXPx3mhkspTf2UWtNnueHwjl90 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026);SRVR:BN6PR12MB1298;BCL:0;PCL:0;RULEID:;SRVR:BN6PR12MB1298; X-Microsoft-Exchange-Diagnostics: 1;BN6PR12MB1298;4:9UziLbpL21YrqrMMrJdktH/1iDI4CFdMb+qxz2rz8UNxj/pBce2KNAOBrLFIB1McEogrVeIhzewEP1FcjO8NqSNIABzfMLJ+eswTaloqz4h8aoiK/omfj7kDWYe6ceYysNnPsMrsnfyhttavCMgh0LUaozTVLLQ0PpCxbxNVBVpDhvivJH0acaHcA/wCtXmztBOUfiZnQeoUzN8lF8wh6SS0RQzaublON1TlyIovZfgGktZw33M17r3gcqXAbLAcQaA0CMD9Q3FkHsGEOMSURtLLVY6ePyU+J7O+YtQY/NImNnpPR3TLvGMoI4Jz6gt5bHDZHuFJwUoOSrQ8KLqdjUzXrJ1yMzgmqRXNfcu8103PdBWBFA1tOWz4ZGDQGJwkSTCTCd7mR6OTeSLw1x1BPrqxktSr7sfNYbqkdxmFJL8= X-Forefront-PRVS: 0093C80C01 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(189002)(54356999)(76176999)(64126003)(2906002)(2201001)(33646002)(86362001)(561944003)(101416001)(6116002)(42186005)(92566002)(2950100002)(106356001)(1706002)(77096005)(31686004)(6666003)(50466002)(50986999)(586003)(305945005)(31696002)(7736002)(36756003)(7846002)(230700001)(5001770100001)(7406005)(65826007)(5660300001)(83506001)(105586002)(23676002)(68736007)(4001350100001)(7416002)(65806001)(8676002)(47776003)(65956001)(15650500001)(189998001)(81156014)(81166006)(97736004)(107886002)(921003)(3826002)(2101003)(1121003)(83996005);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR12MB1298;H:[IPv6:2a02:908:1251:7981:a462:f0a8:bb07:e87a];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMjk4OzIzOjkxZ1ZaT1VrWnNOVFpVRHduOFJ3cXZRQ1Zj?= =?utf-8?B?T2M0Nm1ra2xuM0dxeUp5dEEzODBoRy9RekZOSzFsckZQUGVjZHJkZE9lRkhI?= =?utf-8?B?NnVxQ05SVWppNkRtcUpDRDhOcmNRT25xcmc3dTRCeExQM1Rka2YwT2d5SS90?= =?utf-8?B?aE9DT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L3w536enVqIgoyooJwfTNAk4UVE/s9d3/AWxseX/VwWuqdkVarAH8zz6YRLTDdkSS0pcnUk8mYvQ0DNMR7EOpt+iO47S4qUBSKYCFAIkxEh/qIebX4n1HBItnltJf5xgxf1RpyhIyD2O0v6Jdxg/09+aMIk8lI42+wfxfU7+YjU0yWHxulIztQ19rwwC6aGGzNh7WmPb2qx X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2016 09:09:59.1253 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1298 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1047 Lines: 24 Am 12.10.2016 um 01:50 schrieb Ruchi Kandoi: > This patchstack adds memtrack hooks into dma-buf and ion. If there's upstream > interest in memtrack, it can be extended to other memory allocators as well, > such as GEM implementations. We have run into similar problems before. Because of this I already proposed a solution for this quite a while ago, but never pushed on upstreaming this since it was only done for a special use case. Instead of keeping track of how much memory a process has bound (which is very fragile) my solution only added some more debugging info on a per fd basis (e.g. how much memory is bound to this fd). This information was then used by the OOM killer (for example) to make a better decision on which process to reap. Shouldn't be to hard to expose this through debugfs or maybe a new fcntl to userspace for debugging. I haven't looked at the code in detail, but messing with the per process memory accounting like you did in this proposal is clearly not a good idea if you ask me. Regards, Christian.