From owner-freebsd-sparc64@FreeBSD.ORG Sun Dec 3 05:30:18 2006 Return-Path: X-Original-To: freebsd-sparc64@hub.freebsd.org Delivered-To: freebsd-sparc64@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DE47216A407 for ; Sun, 3 Dec 2006 05:30:18 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id D185243CA3 for ; Sun, 3 Dec 2006 05:29:53 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kB35UIVF027363 for ; Sun, 3 Dec 2006 05:30:18 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kB35UIIC027362; Sun, 3 Dec 2006 05:30:18 GMT (envelope-from gnats) Resent-Date: Sun, 3 Dec 2006 05:30:18 GMT Resent-Message-Id: <200612030530.kB35UIIC027362@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-sparc64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Patrick Baggett Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E402116A40F for ; Sun, 3 Dec 2006 05:23:29 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 364D343CA2 for ; Sun, 3 Dec 2006 05:23:05 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id kB35NTGx062727 for ; Sun, 3 Dec 2006 05:23:29 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id kB35NT9h062726; Sun, 3 Dec 2006 05:23:29 GMT (envelope-from nobody) Message-Id: <200612030523.kB35NT9h062726@www.freebsd.org> Date: Sun, 3 Dec 2006 05:23:29 GMT From: Patrick Baggett To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: sparc64/106251: malloc fails > for large allocations X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Dec 2006 05:30:18 -0000 >Number: 106251 >Category: sparc64 >Synopsis: malloc fails > for large allocations >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-sparc64 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Dec 03 05:30:12 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Patrick Baggett >Release: 6.2-RC1 >Organization: Figgle Software >Environment: FreeBSD SPARCLE.figglesoftware.com 6.2-RC1 FreeBSD 6.2-RC1 #0:Fri Nov 17 02.52.51 UTC 2006 root@s-dallas.cse.buffalo.edu/usr/obj/usr/src/sys/GENERIC sparc64 >Description: I have program that allocates four 768MB blocks of contiguous memory (total of 3GB = 4x768MB) and runs some operations on them. The after the first call (which successfully allocates the memory), the next 3 return NULL as if there was no memory available. Well... The system I work on is an Enterprise 420R 4xUltraSPARC II 400MHz with 4GB RAM. Running 'top' shows that right before running, there is 3667MB of free RAM, and 1024MB of swap available. This should be more than enough to allocate 3GB of RAM, or at least one more 768MB block (for a total of 1.5GB). I compiled this program as a 64 bit program using GCC, so I don't think it should be hitting the line for > 32 bit pointers. Even still, an x86 box could theoretically run this program too. I have successfully compiled and tested the program under Solaris 10, so I don't think there is an error in my source code. Running 'prstat' on Solaris 10 (similar to 'top' if you haven't used Solaris) shows the appropriate 3072MB of allocated RAM. FreeBSD should be able to allocate > 3GB of RAM on a 64 bit architecture, especially a 64 bit architecture. >How-To-Repeat: Run the test program included. Fails every time at allocation #2. $ gcc -m64 -O3 dist_fma.c -o dist_fma $ ./dist_fma >Fix: Allow large allocations? Patch attached with submission follows: /* dist_fma.c -- Distributed floating multiply-add to test sparc64 SMP performance Copyright 2006 Figgle Software Authors: Patrick Baggett (baggett.patrick@figglesoftware.com) */ #include #include #include #include #include #define NUM_FMA (1024*1024*192) /* 128M fma */ /* Use entire 64 bit register */ typedef unsigned long long u64; typedef struct FMAJob { float* x; float* y; float* z; float* out; unsigned int base; unsigned int qty; } FMAJob; /* 64 bit timer, millisecond accurate */ u64 Ticks() { struct timeval tv; gettimeofday(&tv, NULL); return (tv.tv_sec*1000) + (tv.tv_usec/1000); } static void* fma_thread(void* job) { FMAJob* pJob = (FMAJob*)job; u64 i; u64 base = pJob->base; for(i=0; iqty; i++) { pJob->out[i] = pJob->x[base+i]*pJob->y[base+i]+pJob->z[base+i]; } return NULL; } void InitData(float* x, float* y, float* z, float* out) { register u64 i; /* By initializing the data, we make sure that all pages are commited, not just reserved */ printf("Initializing data set...\n"); for(i=0; iRelease-Note: >Audit-Trail: >Unformatted: