1. 31 Jul, 2023 9 commits
    • Nils Goroll's avatar
      Unfortunate Flexelinting · 908d7c6c
      Nils Goroll authored
      I have tried hard to make value tracking understand the code, but to
      no avail. It seems, for example
      
      	assert(n <= 56)
      
      and later
      	assert(n > 0)
      
      will just lead to flexelint knowning 1? but not 56 as the limit.
      908d7c6c
    • Nils Goroll's avatar
      b4c3cc11
    • Nils Goroll's avatar
      Flexelinting: Avoid temporary out of bounds pointer · bc498361
      Nils Goroll authored
      it was never accessed, but triggered flexelint
      bc498361
    • Nils Goroll's avatar
      Correct stack regionlist size used during fellow_log_entries_prep() · 20d8a157
      Nils Goroll authored
      First and foremost, fellow_log_prep_max_regions was defined wrong:
      
      Except in fellow_cache_test, we call log submission with a maximum of
      FELLOW_DISK_LOG_BLOCK_ENTRIES = 56 DLEs. The intention of the
      fellow_log_prep_max_regions was was to allocate space to track return
      of the maximum number of regions possibly contained. The exact maximum
      would be (FELLOW_DISK_LOG_BLOCK_ENTRIES - 1) * DLE_REG_NREGION + 1 =
      (55 * 4) + 1 = 221, which is higher than FELLOW_DISK_LOG_BLOCK_ENTRIES
      * DLE_BAN_REG_NREGION = 56 * 3 = 168.
      
      Yet it seems prudent to not reply on any fixed maximum, and also our
      test cases call for a higher value, so we now define the maximum three
      times the actually used value, and also ensure that we batch the code
      to this size.
      
      In addition, one assertion in fellow_log_entries_prep() was wrong (it
      compared a number of DLEs with a number of regions).
      
      We also tighten some assertions to help future analysis of possible
      issues in this area:
      
      - Ensure that the data path via fellow_log_entries_prep() only ever
        uses a region list on the stack.
      
      - By using the regionlist_onlystk_add() macro, ensure that we hit an
        assertion on the array on stack, rather than one on the regionlist
        pointer.
      
      Diff best viewed with -b
      
      Fixes #18
      20d8a157
    • Nils Goroll's avatar
      Rename for clarity · 292ecc59
      Nils Goroll authored
      Related to #18
      292ecc59
    • Nils Goroll's avatar
      Tighten DLE array sizing · db933215
      Nils Goroll authored
      We should do this right and not over-allocate, this is just confusing.
      db933215
    • Nils Goroll's avatar
      Add miniobj check · e112b51f
      Nils Goroll authored
      Motivated by #18, but does not fix the root cause yet
      
      For the call path in the bug ticket, the stack regionlist is supposed
      to be big enough and the root cause is that it is not. But at any
      rate, for that call path, the regionlist is OK to be NULL and
      regionlist_add() should never be called.
      
      If, however, it _is_ called, the regionlist can't be NULL.
      e112b51f
    • Nils Goroll's avatar
      b7b26499
    • Nils Goroll's avatar
      Call try_flags() even when there are no flags to try · bd33e5d5
      Nils Goroll authored
      Avoids:
      
      fellow_io_uring.c:234:1: error: ‘try_flag’ defined but not used [-Werror=unused-function]
        234 | try_flag(unsigned flag)
            | ^~~~~~~~
      bd33e5d5
  2. 28 Jul, 2023 2 commits
    • Nils Goroll's avatar
      Batch LRU changes · cb92c844
      Nils Goroll authored
      the lru_mtx is our most contended mtx.
      
      As a first improvement, batch changes to LRU for multiple segments
      and maintain the effective change locally outside the lru mtx (but
      while holding the obj mtx).
      cb92c844
    • Nils Goroll's avatar
      Minor refactor · da5d8b9e
      Nils Goroll authored
      da5d8b9e
  3. 24 Jul, 2023 23 commits
  4. 21 Jul, 2023 6 commits
    • Nils Goroll's avatar
      Limit chunk_bytes more strictly · da63a5b8
      Nils Goroll authored
      The main cause for #11 seems to be that the chunk size in relation to
      the memory cache was too big.
      
      We now clamp it at memsz >> 10 (less than 1/1024 of the memsz).
      
      This can still lead to issues when the memory size is reduced and
      the cache reloaded, but then at least new objects will not compete
      for the available memory.
      da63a5b8
    • Nils Goroll's avatar
      7bc0fc0d
    • Nils Goroll's avatar
    • Nils Goroll's avatar
      Differentiate memory allocation priorities · 4dcda2c0
      Nils Goroll authored
      Fixes #11 I hope
      4dcda2c0
    • Nils Goroll's avatar
      Introduce new priorities · ed28758e
      Nils Goroll authored
      ed28758e
    • Nils Goroll's avatar
      Decide against extending the log at this point - no oa_present yet · 7125d0c7
      Nils Goroll authored
      With the previous commit, we restore the objcore's oa_present field
      when we first read the object.
      
      On top of that, it would be nice if we could restore the field or at
      least the bit for OA_VARY when we read the log, because a cache lookup
      checks it and could avoid reading objects if the OA_VARY bit is not
      set.
      
      On the other hand, if vary is used, the object needs to be read
      anyway, so restoring oa_present during log read only payed off for no
      vary.
      
      The straight forward solution would be to add 2 bytes to struct
      fellow_dle_obj. This would
      
      - require a DLE version bump and compatibility code
      - bump the dle size from 72 to 80 bytes (because alignment)
      - consequently, reduce FELLOW_DISK_LOG_BLOCK_ENTRIES from 56 to 4032 /
        80 = 50
      
      All this is possible and part of the fellow design, but at
      this point I conclude that it is not worth the effort.
      
      Another option would be to cram two bits into the existing
      fellow_dle_obj, for example by exploiting the fact that the sign bit
      of ban and t_origin is always zero. This could break backwards
      compatibility, so we prepare for the option, but do not implement it.
      
      All in all, we just add a TODO to add this when we need to extend the
      DLE anyway.
      
      Closes #17
      7125d0c7