[maemo-commits] [maemo-commits] r18214 - in projects/haf/trunk/libosso: . debian src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon May 4 14:05:05 EEST 2009
Author: kihamala
Date: 2009-05-04 14:04:53 +0300 (Mon, 04 May 2009)
New Revision: 18214

Modified:
   projects/haf/trunk/libosso/configure.ac
   projects/haf/trunk/libosso/debian/changelog
   projects/haf/trunk/libosso/src/osso-mem.c
Log:
releasing


Modified: projects/haf/trunk/libosso/configure.ac
===================================================================
--- projects/haf/trunk/libosso/configure.ac	2009-05-04 09:45:03 UTC (rev 18213)
+++ projects/haf/trunk/libosso/configure.ac	2009-05-04 11:04:53 UTC (rev 18214)
@@ -1,5 +1,5 @@
 # -*- sh -*-
-AC_INIT([libosso], [2.19])
+AC_INIT([libosso], [2.20])
 AC_CONFIG_SRCDIR([src/libosso.h])
 AM_INIT_AUTOMAKE([-Wall])
 AM_CONFIG_HEADER([config.h])

Modified: projects/haf/trunk/libosso/debian/changelog
===================================================================
--- projects/haf/trunk/libosso/debian/changelog	2009-05-04 09:45:03 UTC (rev 18213)
+++ projects/haf/trunk/libosso/debian/changelog	2009-05-04 11:04:53 UTC (rev 18214)
@@ -1,10 +1,12 @@
-libosso (2.20-1~unreleased) unstable; urgency=low
+libosso (2.20-1) unstable; urgency=low
 
   * Fix test-hw-prog.c test program.
   * Add signal handler for DSME signals, so that they are received.
   * Remove autogenerated config.h.in from SVN.
+  * Patch from Leonid:
+  * Fixes: NB#112680 - libosso memory hook doesn't work due to enabled swap
 
- -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Wed, 29 Apr 2009 11:00:49 +0300
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Mon, 04 May 2009 12:38:21 +0300
 
 libosso (2.19-1) unstable; urgency=low
 

Modified: projects/haf/trunk/libosso/src/osso-mem.c
===================================================================
--- projects/haf/trunk/libosso/src/osso-mem.c	2009-05-04 09:45:03 UTC (rev 18213)
+++ projects/haf/trunk/libosso/src/osso-mem.c	2009-05-04 11:04:53 UTC (rev 18214)
@@ -115,6 +115,7 @@
 
 /* For lowmem_ functions system limits */
 static size_t sys_avail_memory = NSIZE;
+static size_t sys_avail_ram    = NSIZE;
 static size_t sys_deny_limit   = NSIZE;
 static size_t sys_lowmem_limit = NSIZE;
 
@@ -354,6 +355,9 @@
    /* Discover memory information using loaded numbers */
    usage->total = vals[ID_MEMTOTAL] + vals[ID_SWAPTOTAL];
 
+   if (NSIZE == sys_avail_ram)
+      sys_avail_ram = vals[ID_MEMTOTAL] << 10;
+
    usage->free  = vals[ID_MEMFREE] + vals[ID_BUFFERS] +
                   vals[ID_CACHED] +  vals[ID_SWAPFREE];
 
@@ -464,6 +468,7 @@
             )
 {
    osso_mem_usage_t current;
+   size_t           available;
 
    /* Validate passed parameters. */
    if ( !watchblock )
@@ -476,15 +481,18 @@
       return -EINVAL;
    }
 
+   /* How much memory can we use to keep system alive */
+   available = (sys_avail_ram < current.usable ? sys_avail_ram : current.usable);
+
    /* If we're below the threshold, don't make things worse */
-   if(current.usable > threshold)
+   if(available > threshold)
    {
       const struct mallinfo mi = mallinfo();
 
       THREAD_LOCK();
 
       saw_user_oom_func  = oom_func;
-      saw_max_heap_size  = mi.arena + mi.hblkhd + current.usable - threshold;
+      saw_max_heap_size  = mi.arena + mi.hblkhd + available - threshold;
       saw_max_block_size = watchblock;
       saw_user_context   = context;
       if(saw_malloc_hook != __malloc_hook)
@@ -503,8 +511,8 @@
    }
    else
    {
-      ULOG_WARN_F("SAW: OOM:current.usable(%u) <= threshold(%u)",
-                  current.usable, threshold);
+      ULOG_WARN_F("SAW: OOM: available(%u) <= threshold(%u)",
+                  available, threshold);
       return -EINVAL;
    }
 } /* osso_mem_saw_enable */


More information about the maemo-commits mailing list