Commit da5cf16c authored by Jeffrey Lee's avatar Jeffrey Lee

Try harder when looking for buffer space

Detail:
  s/FileCore30 - Update FindBuffer so that if it failed to find enough spare memory for the buffer (and the RMA is allowed) it will try and grow the RMA dynamic area (current code just aims to use the spare heap space without expanding the DA).
Admin:
  Tested on Raspberry Pi
  Fixes "No room for buffer" error being generated in some situations, following the removal of Wimp_ClaimFreeMemory/free pool locking


Version 3.67. Tagged as 'FileCore-3_67'
parent d13f0444
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "3.66"
Module_Version SETA 366
Module_MajorVersion SETS "3.67"
Module_Version SETA 367
Module_MinorVersion SETS ""
Module_Date SETS "28 Mar 2015"
Module_ApplicationDate SETS "28-Mar-15"
Module_Date SETS "02 Oct 2015"
Module_ApplicationDate SETS "02-Oct-15"
Module_ComponentName SETS "FileCore"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/FileCore"
Module_FullVersion SETS "3.66"
Module_HelpVersion SETS "3.66 (28 Mar 2015)"
Module_FullVersion SETS "3.67"
Module_HelpVersion SETS "3.67 (02 Oct 2015)"
END
/* (3.66)
/* (3.67)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 3.66
#define Module_MajorVersion_CMHG 3.67
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 28 Mar 2015
#define Module_Date_CMHG 02 Oct 2015
#define Module_MajorVersion "3.66"
#define Module_Version 366
#define Module_MajorVersion "3.67"
#define Module_Version 367
#define Module_MinorVersion ""
#define Module_Date "28 Mar 2015"
#define Module_Date "02 Oct 2015"
#define Module_ApplicationDate "28-Mar-15"
#define Module_ApplicationDate "02-Oct-15"
#define Module_ComponentName "FileCore"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/FileCore"
#define Module_FullVersion "3.66"
#define Module_HelpVersion "3.66 (28 Mar 2015)"
#define Module_LibraryVersionInfo "3:66"
#define Module_FullVersion "3.67"
#define Module_HelpVersion "3.67 (02 Oct 2015)"
#define Module_LibraryVersionInfo "3:67"
......@@ -346,6 +346,53 @@ FindBuffer ROUT
]
BLNE %FT90
; With modern kernels not supporting free pool locking, our original
; tactic of just claiming free space without actively growing DAs isn't
; going to work, because we no longer have the free pool to fall back on
; as a source of 'infinite' free memory.
; So if we've failed to find enough free space, and claiming from the
; RMA is allowed, try growing the RMA to be large enough and then give
; it another chance.
CMP R11, R5 ;failed to get min length
CMPLO R9, #1 ;and haven't claimed any yet
BHS %FT17
TST R4, #1 :SHL: UseRmaHeap ;and RMA available
BEQ %FT17
; Try and limit max claim to 1MB so that we don't completely empty the
; free pool. I.e. claim max(min(1MB,max_length),min_length)
CMP R6, #1 :SHL: 20
MOVHS R1, #1 :SHL: 20
MOVLO R1, R6
CMP R1, R5
MOVLO R1, R5
; Round up to size multiple
ADD R1, R1, R7
BIC R1, R1, R7
; Add safety net to ensure background claimants have a little bit of
; free memory to work with
ADD R1, R1, #4096
; Grow dynamic area (will probably leave us with more space than we
; need, but will avoid us claiming all the spare heap space and causing
; issues for background claimants)
MOV R0, #1
[ DebugD
DREG R1, "trying to grow RMA by "
]
SWI XOS_ChangeDynamicArea
[ DebugD
DREG R1, "managed to grow RMA by "
]
; Check RMA again if any grow was performed
CMP R1, #0
BEQ %FT17
MOV R0, #ModHandReason_RMADesc
BL OnlyXOS_Module ;(R0->R0,R2,R3,V)
BVS %FT17
SUBS r2, r2, #2048
MOVGT R0, #UseRmaHeap
BLGT %FT90
17
TSTS R4, #DiscOp_Op_ScatterList_Flag
BEQ %FT20
TEQS R11,#0 ;scatter case, claim any
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment